use of java.awt.MenuItem in project fql by CategoricalData.
the class GUI method populateFpql.
private static void populateFpql(Menu menu) {
MenuItem enrichItem = new MenuItem("FPQL Enrich");
menu.add(enrichItem);
enrichItem.addActionListener(x -> new EnrichViewer());
MenuItem raItem = new MenuItem("RA to FPQL");
menu.add(raItem);
raItem.addActionListener(x -> new XRaToFpql());
MenuItem sqlItem = new MenuItem("SQL to FPQL");
menu.add(sqlItem);
sqlItem.addActionListener(x -> new XSqlToFql());
MenuItem jsonItem = new MenuItem("JSON to FPQL");
menu.add(jsonItem);
jsonItem.addActionListener(x -> new XJsonToFQL());
MenuItem neo4j = new MenuItem("Neo4j to FPQL");
menu.add(neo4j);
neo4j.addActionListener(x -> new XNeo4jToFQL());
MenuItem easik = new MenuItem("EASIK to FPQL");
menu.add(easik);
easik.addActionListener(x -> new XEasikToFQL());
}
use of java.awt.MenuItem in project openblocks by mikaelhg.
the class ContextMenu method initAddCommentMenu.
/**
* Initializes the context menu for adding Comments.
*/
private static void initAddCommentMenu() {
addCommentItem = new MenuItem("Add Comment");
addCommentItem.setActionCommand(ADD_COMMENT_BLOCK);
addCommentItem.addActionListener(rndBlockMenu);
addCommentMenu.add(addCommentItem);
addCommentMenuInit = true;
}
use of java.awt.MenuItem in project openblocks by mikaelhg.
the class ContextMenu method initCanvasMenu.
/**
* Initializes the context menu for the BlockCanvas
*/
private static void initCanvasMenu() {
// TODO some workspaces don't have pages
arrangeAllBlocks = new MenuItem("Organize all blocks");
arrangeAllBlocks.setActionCommand(ARRANGE_ALL_BLOCKS);
arrangeAllBlocks.addActionListener(canvasMenu);
canvasMenu.add(arrangeAllBlocks);
canvasMenuInit = true;
}
use of java.awt.MenuItem in project SKMCLauncher by SKCraft.
the class GameConsoleFrame method setupTrayIcon.
private boolean setupTrayIcon() {
if (!SystemTray.isSupported() || trayOkImage == null || trayClosedImage == null) {
return false;
}
trayIcon = new TrayIcon(trayOkImage);
trayIcon.setImageAutoSize(true);
trayIcon.setToolTip("Messages and Errors for SKMCLauncher");
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
reshow();
}
});
PopupMenu popup = new PopupMenu();
MenuItem item;
popup.add(item = new MenuItem("SKMCLauncher"));
item.setEnabled(false);
popup.add(item = new MenuItem("Show messages and errors"));
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
reshow();
}
});
popup.add(item = new MenuItem("Kill game"));
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
tryKill();
}
});
trayIcon.setPopupMenu(popup);
try {
SystemTray tray = SystemTray.getSystemTray();
tray.add(trayIcon);
return true;
} catch (AWTException e) {
}
return false;
}
use of java.awt.MenuItem in project yyl_example by Relucent.
the class TrayIconTest method main.
public static void main(String[] args) {
// 判断是否支持系统托盘
if (!SystemTray.isSupported()) {
JOptionPane.showMessageDialog(null, "SystemTray is not support !");
}
// 获得Image对象
byte[] imagedata = IoUtil.toByteArray(TrayIconTest.class.getResourceAsStream("ICO128.png"), true);
Image image = Toolkit.getDefaultToolkit().createImage(imagedata);
// 创建托盘图标
TrayIcon trayIcon = new TrayIcon(image);
// 自适应图标大小
trayIcon.setImageAutoSize(true);
// 添加工具提示文本
trayIcon.setToolTip("Hello");
// 创建弹出菜单
PopupMenu popupMenu = new PopupMenu();
popupMenu.add(new MenuItem("Item1"));
popupMenu.add(new MenuItem("Item2"));
popupMenu.add(new MenuItem("Item3"));
popupMenu.addSeparator();
popupMenu.add(new MenuItem("Item4"));
popupMenu.add(new MenuItem("Item5"));
popupMenu.addSeparator();
MenuItem closeMenuItem = new MenuItem("Close");
popupMenu.add(closeMenuItem);
// 为托盘图标加弹出菜弹
trayIcon.setPopupMenu(popupMenu);
// 添加事件
trayIcon.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
// 判断是否双击了鼠标
if (e.getClickCount() == 2) {
JOptionPane.showMessageDialog(null, "double-click");
}
}
});
closeMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SystemTray.getSystemTray().remove(trayIcon);
System.exit(0);
}
});
// 获得系统托盘对象
SystemTray systemTray = SystemTray.getSystemTray();
try {
// 为系统托盘加托盘图标
systemTray.add(trayIcon);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations