use of java.awt.event.WindowEvent in project processing by processing.
the class JavaTextAreaPainter method stopTweakMode.
protected void stopTweakMode() {
tweakMode = false;
if (colorSelector != null) {
colorSelector.hide();
WindowEvent windowEvent = new WindowEvent(colorSelector.frame, WindowEvent.WINDOW_CLOSING);
colorSelector.frame.dispatchEvent(windowEvent);
}
setCursor(new Cursor(Cursor.TEXT_CURSOR));
repaint();
}
use of java.awt.event.WindowEvent in project AozoraEpub3 by hmdev.
the class AozoraEpub3Applet method main.
////////////////////////////////////////////////////////////////
// JFrame
////////////////////////////////////////////////////////////////
/** Jar実行用 */
public static void main(String[] args) {
//LookAndFeel変更
try {
String lafName = UIManager.getSystemLookAndFeelClassName();
//lafName = "";
if (lafName.startsWith("com.sun.java.swing.plaf.windows.")) {
UIManager.setLookAndFeel(lafName);
} else {
//Windows以外はMetalのままでFontはPLAIN
UIDefaults defaultTable = UIManager.getLookAndFeelDefaults();
for (Object o : defaultTable.keySet()) {
if (o.toString().toLowerCase().endsWith("font")) {
FontUIResource font = (FontUIResource) UIManager.get(o);
font = new FontUIResource(font.getName(), Font.PLAIN, font.getSize());
UIManager.put(o, font);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
//フレーム初期化
final JFrame jFrame = new JFrame("AozoraEpub3");
//アップレット生成と初期化
final AozoraEpub3Applet applet = new AozoraEpub3Applet(jFrame);
applet.iconImage = java.awt.Toolkit.getDefaultToolkit().createImage(AozoraEpub3Applet.class.getResource("images/icon.png"));
applet.init();
//アイコン設定
jFrame.setIconImage(applet.iconImage);
//最小サイズ
jFrame.setMinimumSize(new Dimension(520, 320));
jFrame.setPreferredSize(new Dimension(520, 400));
try {
int x = (int) Float.parseFloat(applet.props.getProperty("PosX"));
int y = (int) Float.parseFloat(applet.props.getProperty("PosY"));
jFrame.setLocation(x, y);
} catch (Exception e) {
}
jFrame.setSize(applet.getSize());
try {
int w = (int) Float.parseFloat(applet.props.getProperty("SizeW"));
int h = (int) Float.parseFloat(applet.props.getProperty("SizeH"));
jFrame.setSize(w, h);
} catch (Exception e) {
}
jFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
try {
//Window位置を割くに設定しておく
Point location = jFrame.getLocation();
Dimension size = jFrame.getSize();
applet.props.setProperty("PosX", "" + location.getX());
applet.props.setProperty("PosY", "" + location.getY());
applet.props.setProperty("SizeW", "" + size.getWidth());
applet.props.setProperty("SizeH", "" + size.getHeight());
//props保存と終了処理
applet.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
System.exit(0);
}
});
jFrame.add(applet);
jFrame.setVisible(true);
//引数にファイルが指定されていたら変換実行
for (String fileName : args) {
File file = new File(fileName);
Vector<File> vecFiles = new Vector<File>();
if (file.exists())
vecFiles.add(file);
if (vecFiles.size() > 0) {
File[] files = new File[vecFiles.size()];
for (int i = 0; i < files.length; i++) files[i] = vecFiles.get(i);
applet.startConvertWorker(vecFiles, null, null, null);
}
}
//Focus
applet.jTabbedPane.requestFocus();
}
use of java.awt.event.WindowEvent in project jreversepro by akkumar.
the class GUIMain method addListeners.
/**
* Method to add property listeners to MenuItems and the MainFrame.
*/
private void addListeners() {
mMbrGen.onFileOpen.addActionListener(this);
mMbrGen.onFileSave.addActionListener(this);
mMbrGen.onFileExit.addActionListener(this);
mMbrGen.onEditCut.addActionListener(this);
mMbrGen.onEditCopy.addActionListener(this);
mMbrGen.onViewCPool.addActionListener(this);
mMbrGen.onOptFont.addActionListener(this);
mMbrGen.onHelpAbout.addActionListener(this);
addWindowListener(new WindowAdapter() {
/**
* WindowClosing event handler.
*
* @param aEvent
* Event generated.
*/
@Override
public void windowClosing(WindowEvent aEvent) {
appClose();
super.windowClosing(aEvent);
}
});
}
use of java.awt.event.WindowEvent in project qi4j-sdk by Qi4j.
the class Envisage method showMainFrame.
private void showMainFrame() {
mainFrame = new EnvisageFrame(application);
mainFrame.setLocationByPlatform(true);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
mainFrame.setSize(new Dimension(1024, 768));
mainFrame.setVisible(true);
mainFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent evt) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
mainFrame.initQi4J();
}
});
}
});
}
use of java.awt.event.WindowEvent in project L42 by ElvisResearchGroup.
the class Frame method createNew.
private static Frame createNew(String wName, String html, int x, int y) {
FutureTask<Frame> future = new FutureTask<>(() -> {
final Frame frame = new Frame(Frame.extractTitle(html));
JFXPanel jfxPanel = new JFXPanel();
frame.createHtmlContent(jfxPanel, html);
frame.getContentPane().add(jfxPanel);
frame.setMinimumSize(new Dimension(x, y));
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
Frame.close(wName);
}
});
frame.setVisible(true);
return frame;
});
SwingUtilities.invokeLater(future);
try {
return future.get();
} catch (ExecutionException e) {
throw propagateException(e.getCause());
} catch (InterruptedException e) {
throw propagateException(e);
}
}
Aggregations