forked from External/mage
[refactoring][minor] Replaced all tabs with four spaces.
This commit is contained in:
parent
e646e4768d
commit
239a4fb100
2891 changed files with 79411 additions and 79411 deletions
|
|
@ -33,7 +33,7 @@ package mage;
|
|||
/*
|
||||
* TrayIconDemo.java
|
||||
*/
|
||||
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
|
@ -41,7 +41,7 @@ import java.awt.event.ActionListener;
|
|||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.net.URL;
|
||||
|
||||
|
||||
public class TrayIconDemo {
|
||||
public static void main(String[] args) {
|
||||
/* Use an appropriate Look and Feel */
|
||||
|
|
@ -68,7 +68,7 @@ public class TrayIconDemo {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static void createAndShowGUI() {
|
||||
//Check the SystemTray support
|
||||
if (!SystemTray.isSupported()) {
|
||||
|
|
@ -79,7 +79,7 @@ public class TrayIconDemo {
|
|||
final TrayIcon trayIcon =
|
||||
new TrayIcon(createImage("images/bulb.gif", "tray icon"));
|
||||
final SystemTray tray = SystemTray.getSystemTray();
|
||||
|
||||
|
||||
// Create a popup menu components
|
||||
MenuItem aboutItem = new MenuItem("About");
|
||||
CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
|
||||
|
|
@ -90,7 +90,7 @@ public class TrayIconDemo {
|
|||
MenuItem infoItem = new MenuItem("Info");
|
||||
MenuItem noneItem = new MenuItem("None");
|
||||
MenuItem exitItem = new MenuItem("Exit");
|
||||
|
||||
|
||||
//Add components to popup menu
|
||||
popup.add(aboutItem);
|
||||
popup.addSeparator();
|
||||
|
|
@ -103,30 +103,30 @@ public class TrayIconDemo {
|
|||
displayMenu.add(infoItem);
|
||||
displayMenu.add(noneItem);
|
||||
popup.add(exitItem);
|
||||
|
||||
|
||||
trayIcon.setPopupMenu(popup);
|
||||
|
||||
|
||||
try {
|
||||
tray.add(trayIcon);
|
||||
} catch (AWTException e) {
|
||||
System.out.println("TrayIcon could not be added.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
trayIcon.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
"This dialog box is run from System Tray");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
aboutItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
"This dialog box is run from the About menu item");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cb1.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
int cb1Id = e.getStateChange();
|
||||
|
|
@ -137,7 +137,7 @@ public class TrayIconDemo {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cb2.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
int cb2Id = e.getStateChange();
|
||||
|
|
@ -148,7 +148,7 @@ public class TrayIconDemo {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ActionListener listener = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MenuItem item = (MenuItem)e.getSource();
|
||||
|
|
@ -158,17 +158,17 @@ public class TrayIconDemo {
|
|||
//type = TrayIcon.MessageType.ERROR;
|
||||
trayIcon.displayMessage("Sun TrayIcon Demo",
|
||||
"This is an error message", TrayIcon.MessageType.ERROR);
|
||||
|
||||
|
||||
} else if ("Warning".equals(item.getLabel())) {
|
||||
//type = TrayIcon.MessageType.WARNING;
|
||||
trayIcon.displayMessage("Sun TrayIcon Demo",
|
||||
"This is a warning message", TrayIcon.MessageType.WARNING);
|
||||
|
||||
|
||||
} else if ("Info".equals(item.getLabel())) {
|
||||
//type = TrayIcon.MessageType.INFO;
|
||||
trayIcon.displayMessage("Sun TrayIcon Demo",
|
||||
"This is an info message", TrayIcon.MessageType.INFO);
|
||||
|
||||
|
||||
} else if ("None".equals(item.getLabel())) {
|
||||
//type = TrayIcon.MessageType.NONE;
|
||||
trayIcon.displayMessage("Sun TrayIcon Demo",
|
||||
|
|
@ -176,12 +176,12 @@ public class TrayIconDemo {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
errorItem.addActionListener(listener);
|
||||
warningItem.addActionListener(listener);
|
||||
infoItem.addActionListener(listener);
|
||||
noneItem.addActionListener(listener);
|
||||
|
||||
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
tray.remove(trayIcon);
|
||||
|
|
@ -189,11 +189,11 @@ public class TrayIconDemo {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Obtain the image URL
|
||||
protected static Image createImage(String path, String description) {
|
||||
URL imageURL = TrayIconDemo.class.getResource(path);
|
||||
|
||||
|
||||
if (imageURL == null) {
|
||||
System.err.println("Resource not found: " + path);
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue