upravena kompilace presun do složky resurces
11
build.xml
|
|
@ -69,5 +69,16 @@
|
|||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
-->
|
||||
<target name="-post-compile">
|
||||
<copy todir="${build.classes.dir}">
|
||||
<fileset dir="resources"/>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="-post-jar">
|
||||
<copy todir="${dist.jar.dir}">
|
||||
<fileset dir="resources"/>
|
||||
</copy>
|
||||
</target>
|
||||
</project>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 725 B After Width: | Height: | Size: 725 B |
|
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 644 B |
|
Before Width: | Height: | Size: 634 B After Width: | Height: | Size: 634 B |
|
Before Width: | Height: | Size: 679 B After Width: | Height: | Size: 679 B |
|
Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 769 B |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 188 B |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 362 B |
|
Before Width: | Height: | Size: 312 B After Width: | Height: | Size: 312 B |
|
Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 659 B |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 397 B |
|
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 313 B |
|
Before Width: | Height: | Size: 802 B After Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 1023 B After Width: | Height: | Size: 1023 B |
|
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 177 B |
|
|
@ -1,11 +1,11 @@
|
|||
package jnet.client;
|
||||
|
||||
import jnet.client.gui.Tray;
|
||||
import jnet.client.gui.Window;
|
||||
import jnet.client.network.NettyClient;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import jnet.client.gui.Tray;
|
||||
import jnet.lib.BuilddDate;
|
||||
import jnet.lib.LogFile;
|
||||
import jnet.lib.PropertiesManager;
|
||||
|
|
@ -17,6 +17,7 @@ import jnet.lib.object.ServerConfig;
|
|||
import jnet.lib.object.SnmpProfile;
|
||||
import jnet.lib.object.User;
|
||||
|
||||
|
||||
public class Client {
|
||||
|
||||
// verze serveru
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ public class ClientMessageParser {
|
|||
for (int i = 0; i < map.getObjects().size(); i++) {
|
||||
if (map.getObjects().get(i).getId() == mo.getId()) {
|
||||
map.getObjects().set(i, mo);
|
||||
UIUpdater.updateMapView();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class MenuPanel extends JPanel {
|
|||
|
||||
// tlacitko pripojit / odpojit
|
||||
try {
|
||||
BufferedImage buttonIcon = ImageIO.read(new File("img/connect.png"));
|
||||
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/connect.png"));
|
||||
JButton bLogin = new JButton(new ImageIcon(buttonIcon));
|
||||
bLogin.setFocusPainted(false);
|
||||
bLogin.setContentAreaFilled(false);
|
||||
|
|
@ -44,7 +44,7 @@ class MenuPanel extends JPanel {
|
|||
|
||||
// tlacitko nastaveni
|
||||
try {
|
||||
BufferedImage buttonIcon = ImageIO.read(new File("img/settings.png"));
|
||||
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/settings.png"));
|
||||
JButton bSettings = new JButton(new ImageIcon(buttonIcon));
|
||||
bSettings.setFocusPainted(false);
|
||||
bSettings.setContentAreaFilled(false);
|
||||
|
|
@ -62,7 +62,7 @@ class MenuPanel extends JPanel {
|
|||
|
||||
// tlacitko log
|
||||
try {
|
||||
BufferedImage buttonIcon = ImageIO.read(new File("img/log.png"));
|
||||
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/log.png"));
|
||||
JButton bLog = new JButton(new ImageIcon(buttonIcon));
|
||||
bLog.setFocusPainted(false);
|
||||
bLog.setContentAreaFilled(false);
|
||||
|
|
@ -80,7 +80,7 @@ class MenuPanel extends JPanel {
|
|||
|
||||
// tlacitko server settings
|
||||
try {
|
||||
BufferedImage buttonIcon = ImageIO.read(new File("img/server_settings.png"));
|
||||
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/server_settings.png"));
|
||||
JButton bServerSettings = new JButton(new ImageIcon(buttonIcon));
|
||||
bServerSettings.setFocusPainted(false);
|
||||
bServerSettings.setContentAreaFilled(false);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class StatusBar extends JPanel {
|
|||
|
||||
// tlacitko zobrazujici klienty
|
||||
try {
|
||||
BufferedImage buttonIcon = ImageIO.read(new File("img/online_clients.png"));
|
||||
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/online_clients.png"));
|
||||
btnOnline = new JButton(new ImageIcon(buttonIcon));
|
||||
btnOnline.setFocusPainted(false);
|
||||
btnOnline.setContentAreaFilled(false);
|
||||
|
|
|
|||
|
|
@ -1,82 +1,67 @@
|
|||
package jnet.client.gui;
|
||||
|
||||
import jnet.client.Client;
|
||||
import java.awt.AWTException;
|
||||
import java.awt.MenuItem;
|
||||
import java.awt.PopupMenu;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import javax.imageio.ImageIO;
|
||||
import jnet.client.Client;
|
||||
import jnet.lib.LogFile;
|
||||
import jnet.lib.Status;
|
||||
import jnet.lib.object.Map;
|
||||
import jnet.lib.object.MapObject;
|
||||
|
||||
public class Tray {
|
||||
|
||||
private SystemTray tray = SystemTray.getSystemTray();
|
||||
private SystemTray tray;
|
||||
private static TrayIcon trayIcon;
|
||||
private static PopupMenu menu = new PopupMenu();
|
||||
|
||||
public void createAndShowTray() {
|
||||
try {
|
||||
|
||||
//Check the SystemTray is supported
|
||||
// Ověření, zda je SystemTray podporován
|
||||
if (!SystemTray.isSupported()) {
|
||||
LogFile.printErr("SystemTray is not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
// tray menu
|
||||
// Menu pro tray ikonu
|
||||
MenuItem exitItem = new MenuItem("Ukončit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
LogFile.printInfo("Exit appliaction from tray icon");
|
||||
System.exit(0);
|
||||
}
|
||||
exitItem.addActionListener(e -> {
|
||||
LogFile.printInfo("Exit application from tray icon");
|
||||
System.exit(0);
|
||||
});
|
||||
menu.add(exitItem);
|
||||
|
||||
trayIcon = new TrayIcon(ImageIO.read(new File("img/flag_gray.png")), Client.APP_NAME, menu);
|
||||
trayIcon.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//Double click - obnovit/minimalizovat
|
||||
if (Client.okno.isVisible()) {
|
||||
Client.okno.setVisible(false);
|
||||
} else {
|
||||
Client.okno.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
// Načtení výchozí ikony ze zdrojů
|
||||
trayIcon = new TrayIcon(loadImage("/img/flag_gray.png"), Client.APP_NAME, menu);
|
||||
trayIcon.setImageAutoSize(true);
|
||||
trayIcon.addActionListener(e -> {
|
||||
// Dvojklik - obnovit/minimalizovat okno
|
||||
Client.okno.setVisible(!Client.okno.isVisible());
|
||||
});
|
||||
|
||||
tray = SystemTray.getSystemTray();
|
||||
tray.add(trayIcon);
|
||||
|
||||
} catch (IOException ex) {
|
||||
LogFile.printErr("TrayIcon error: " + ex.getMessage());
|
||||
} catch (AWTException ex) {
|
||||
} catch (IOException | AWTException ex) {
|
||||
LogFile.printErr("TrayIcon error: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static BufferedImage loadImage(String path) throws IOException {
|
||||
try (var input = Tray.class.getResourceAsStream(path)) {
|
||||
if (input == null) {
|
||||
throw new IOException("Soubor nenalezen: " + path);
|
||||
}
|
||||
return ImageIO.read(input);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setIcon(String icon) {
|
||||
try {
|
||||
BufferedImage image = ImageIO.read(new File("img/" + icon));
|
||||
trayIcon.setImage(image);
|
||||
trayIcon.setImage(loadImage("/img/" + icon));
|
||||
} catch (IOException ex) {
|
||||
LogFile.printErr("TrayIcon error: " + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void setStatusOffline() {
|
||||
|
|
@ -100,13 +85,12 @@ public class Tray {
|
|||
|
||||
for (Map map : Client.maps) {
|
||||
int status = map.getStatus();
|
||||
|
||||
if (status == Status.OFFLINE) {
|
||||
setStatusOffline(); // OFFLINE má nejvyšší prioritu
|
||||
setStatusOffline();
|
||||
return;
|
||||
}
|
||||
if (status == Status.WARNING) {
|
||||
setStatusWarning(); // Možná varování, ale pokračujeme
|
||||
setStatusWarning();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package jnet.client.gui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import jnet.lib.object.Map;
|
||||
|
||||
|
||||
public class UIUpdater {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ public class Window extends JFrame {
|
|||
} catch (IOException ex) {
|
||||
LogFile.printErr("APP icon exception");
|
||||
}
|
||||
|
||||
this.addWindowListener(new WindowAdapter() {
|
||||
|
||||
@Override
|
||||
|
|
|
|||