New version of everything

This commit is contained in:
fls committed 2026-07-16 15:28:00 -03:00
1 parent c13dd4282b
commit 24b0db40ed
79 files changed
+7278

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="pitiupi.screenCast" default="default" basedir=".">
<description>Builds, tests, and runs the project pitiupi.screenCast.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="pitiupi.screenCast-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
@@ -0,0 +1,6 @@
#Thu, 16 Jul 2026 15:21:39 -0300
/home/flavio/NetBeansProjects/pitiupi.screenCast=
/home/flavio/NetBeansProjects/pitiupi=
@@ -0,0 +1 @@
pitiupi.screenCast.plugin.ScreenCastPlugin
+32
View File
@@ -0,0 +1,32 @@
========================
BUILD OUTPUT DESCRIPTION
========================
When you build an Java application project that has a main class, the IDE
automatically copies all of the JAR
files on the projects classpath to your projects dist/lib folder. The IDE
also adds each of the JAR files to the Class-Path element in the application
JAR files manifest file (MANIFEST.MF).
To run the project from the command line, go to the dist folder and
type the following:
java -jar "pitiupi.screenCast.jar"
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
Notes:
* If two JAR files on the project classpath have the same name, only the first
JAR file is copied to the lib folder.
* Only JAR files are copied to the lib folder.
If the classpath contains other types of files or folders, these files (folders)
are not copied.
* If a library on the projects classpath also has a Class-Path element
specified in the manifest,the content of the Class-Path element has to be on
the projects runtime path.
* To set a main class in a standard Java project, right-click the project node
in the Projects window and choose Properties. Then click Run and enter the
class name in the Main Class field. Alternatively, you can manually type the
class name in the manifest Main-Class element.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,8 @@
build.xml.data.CRC32=96758119
build.xml.script.CRC32=70726a23
build.xml.stylesheet.CRC32=f85dc8f2@1.119.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=96758119
nbproject/build-impl.xml.script.CRC32=0f906282
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.119.0.48
@@ -0,0 +1,2 @@
compile.on.save=true
user.properties.file=/home/flavio/snap/netbeans/145/build.properties
@@ -0,0 +1,98 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/pitiupi.screenCast.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/pitiupi.screenCast
excludes=
includes=**
jar.compress=false
javac.classpath=\
${reference.pitiupi.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=25
javac.target=25
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
# The jlink additional root modules to resolve
jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=pitiupi.screenCast
main.class=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
project.pitiupi=../pitiupi
reference.pitiupi.jar=${project.pitiupi}/dist/pitiupi.jar
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
+25
View File
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>pitiupi.screenCast</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>pitiupi</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
</references>
</configuration>
</project>
@@ -0,0 +1 @@
pitiupi.screenCast.plugin.ScreenCastPlugin
@@ -0,0 +1,31 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package pitiupi.screenCast.GUI;
import java.awt.event.ActionEvent;
import javax.swing.JMenu;
/**
*
* @author flavio
*/
public class ScreenCastMenu extends JMenu {
private final ScreenCastWindow screenCastWindow;
private final javax.swing.JMenuItem menuItem;
public ScreenCastMenu(ScreenCastWindow screenCastWindow) {
this.screenCastWindow = screenCastWindow;
this.setText("Screen Cast");
menuItem = new javax.swing.JMenuItem();
menuItem.setText("ScreenCast Window");
menuItem.addActionListener(this::chatMenuActionPerformed);
this.add(menuItem);
}
private void chatMenuActionPerformed(ActionEvent ae) {
this.screenCastWindow.setVisible(true);
}
}
@@ -0,0 +1,135 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pitiupi.screenCast.GUI;
import pitiupi.screenCast.control.AlarmClock;
import pitiupi.screenCast.control.ImageTransformation;
import pitiupi.screenCast.control.ScreenShot;
import pitiupi.screenCast.net.ScreenCastMessage;
import java.awt.AWTException;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Timer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import pitiupi.GUI.MainWindow;
import pitiupi.net.Message;
/**
*
* @author flavio
*/
public class ScreenCastWindow extends javax.swing.JFrame {
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTabbedPane tabbedPane;
private javax.swing.JCheckBox onlineButton;
private AlarmClock alarmClock;
private Timer timer;
public final static int TIME = 1000;
private float compressRatio;
private final MainWindow mainWindow;
public ScreenCastWindow(MainWindow mainWindow) {
this.mainWindow = mainWindow;
this.compressRatio = 0.5f;
this.initComponents();
}
private void initComponents() {
this.setTitle("screen cast");
onlineButton = new javax.swing.JCheckBox("Sharing?");
onlineButton.setSelected(false);
onlineButton.addActionListener(this::onlineButtonActionPerformed);
this.getContentPane().add(onlineButton, java.awt.BorderLayout.NORTH);
jScrollPane1 = new javax.swing.JScrollPane();
tabbedPane = new javax.swing.JTabbedPane();
jScrollPane1.setViewportView(tabbedPane);
this.getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
this.pack();
this.timer = new Timer();
this.setSize(new java.awt.Dimension(1024, 768));
}
public void shareMySheet(boolean status) {
if (status) {
this.timer = new Timer();
this.alarmClock = new AlarmClock(this);
this.timer.scheduleAtFixedRate(this.alarmClock, 0, ScreenCastWindow.TIME);
} else {
this.timer.cancel();
}
}
public void closeCurrentTab() {
if (tabbedPane.getSelectedIndex() > 0) {
tabbedPane.remove(tabbedPane.getSelectedIndex());
}
}
public void exit() {
this.shareMySheet(false);
}
public void sendScreenCastMessage() {
byte[] msg = null;
try {
BufferedImage image = ScreenShot.takeAShot();
BufferedImage rescaled = ImageTransformation.resize(image, 1024, 768);
byte[] byteImage = ImageTransformation.compress(rescaled, compressRatio);
ScreenCastMessage message = new ScreenCastMessage(this.mainWindow.getUserName(), byteImage);
msg = message.toByteArray();
} catch (AWTException | IOException ex) {
Logger.getLogger(AlarmClock.class.getName()).log(Level.SEVERE, null, ex);
}
if (msg != null) {
try {
this.mainWindow.getSocket().send(msg);
} catch (IOException ex) {
System.out.println(ex.toString());
this.compressRatio -= 0.1f;
}
}
}
public void receiveScreenCastMessage(ScreenCastMessage message) {
ByteArrayInputStream bais = new ByteArrayInputStream(message.getImageByte());
BufferedImage image;
try {
image = ImageIO.read(bais);
ImageIcon imageIcon = new ImageIcon(image);
JLabel myShoot = new JLabel(imageIcon);
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
String title = tabbedPane.getTitleAt(i);
if (title.equals(message.getName())) {
tabbedPane.setComponentAt(i, myShoot);
return;
}
}
tabbedPane.addTab(message.getName(), myShoot);
} catch (IOException ex) {
Logger.getLogger(ScreenCastWindow.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void onlineButtonActionPerformed(ActionEvent ae) {
this.shareMySheet(this.onlineButton.isSelected());
}
}
@@ -0,0 +1,27 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pitiupi.screenCast.control;
import java.util.TimerTask;
import pitiupi.screenCast.GUI.ScreenCastWindow;
/**
*
* @author flavio
*/
public class AlarmClock extends TimerTask {
private final ScreenCastWindow screenCastWindow;
public AlarmClock(ScreenCastWindow mainWindow) {
this.screenCastWindow = mainWindow;
}
@Override
public void run() {
this.screenCastWindow.sendScreenCastMessage();
}
}
@@ -0,0 +1,67 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pitiupi.screenCast.control;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Iterator;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
/**
*
* @author flavio
*/
public class ImageTransformation {
public static byte[] toByteArray(BufferedImage image) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "jpg", baos);
byte[] data = baos.toByteArray();
return data;
}
public static byte[] compress(BufferedImage image, float scale) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("jpg");
ImageWriter writer = writers.next();
ImageWriteParam param = writer.getDefaultWriteParam();
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
param.setCompressionQuality(scale);
ImageOutputStream ios = ImageIO.createImageOutputStream(baos);
writer.setOutput(ios);
writer.write(null, new IIOImage(image, null, null), param);
byte[] data = baos.toByteArray();
writer.dispose();
return data;
}
public static BufferedImage resize(BufferedImage img, int maxWidth, int maxHeight) throws IOException {
int scaledWidth = maxWidth;
int scaledHeight = (int) (img.getHeight() * ((double) scaledWidth / img.getWidth()));
if (scaledHeight > maxHeight) {
scaledHeight = maxHeight;
scaledWidth = (int) (img.getWidth() * ((double) scaledHeight / img.getHeight()));
if (scaledWidth > maxWidth) {
scaledWidth = maxWidth;
scaledHeight = maxHeight;
}
}
Image resized = img.getScaledInstance(scaledWidth, scaledHeight, Image.SCALE_SMOOTH);
BufferedImage buffered = new BufferedImage(scaledWidth, scaledHeight, Image.SCALE_REPLICATE);
buffered.getGraphics().drawImage(resized, 0, 0, null);
return buffered;
}
}
@@ -0,0 +1,27 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pitiupi.screenCast.control;
import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.IOException;
/**
*
* @author flavio
*/
public class ScreenShot {
public static BufferedImage takeAShot() throws AWTException, IOException {
Robot robot = new Robot();
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage output = robot.createScreenCapture(screenRect);
return output;
}
}
@@ -0,0 +1,55 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pitiupi.screenCast.net;
import pitiupi.net.Message;
/**
*
* @author flavio
*/
public class ScreenCastMessage extends Message {
private String name;
private byte[] imageByte;
public ScreenCastMessage() {
}
public ScreenCastMessage(String name, byte[] imageByte) {
this.name = name;
this.imageByte = imageByte;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the imageByte
*/
public byte[] getImageByte() {
return imageByte;
}
/**
* @param imageByte the image to set
*/
public void setImageByte(byte[] imageByte) {
this.imageByte = imageByte;
}
}
@@ -0,0 +1,69 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package pitiupi.screenCast.plugin;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import pitiupi.GUI.MainWindow;
import pitiupi.net.Message;
import pitiupi.plugin.Plugin;
import pitiupi.screenCast.GUI.ScreenCastMenu;
import pitiupi.screenCast.GUI.ScreenCastWindow;
import pitiupi.screenCast.net.ScreenCastMessage;
/**
*
* @author flavio
*/
public class ScreenCastPlugin implements Plugin {
private ScreenCastWindow screenCastWindow;
private MainWindow mainWindow;
@Override
public String getName() {
return "ScreenCast";
}
@Override
public String getAuthor() {
return "Flávio Schiavoni";
}
@Override
public String getVersion() {
return "0.0";
}
@Override
public void createPlugin(MainWindow mainWindow) {
this.mainWindow = mainWindow;
this.screenCastWindow = new ScreenCastWindow(mainWindow);
this.mainWindow.addMenu(new ScreenCastMenu(screenCastWindow));
}
@Override
public void receiveMessage(byte[] message) {
ByteArrayInputStream bis = new ByteArrayInputStream(message);
ObjectInputStream ois;
try {
ois = new ObjectInputStream(bis);
if (ois.readObject() instanceof ScreenCastMessage msg) {
this.screenCastWindow.receiveScreenCastMessage(msg);
}
} catch (IOException ex) {
System.out.println(ex.toString());
} catch (ClassNotFoundException ex) {
System.out.println(ex.toString());
}
}
@Override
public Message getMessage() {
return new ScreenCastMessage();
}
}