/** * Calculate the middle position of a window relativ to */ public static Point calculateMiddlePosition(Window win) { return calculateMiddlePosition(null, win); }
/** * */ public static void main(String[] args) { JFrame fr = new JFrame(); fr.add(new MandelbrotPanel()); fr.setLocation(SGUI.calculateMiddlePosition(fr)); fr.pack(); fr.setVisible(true); } }
/** * */ public void createGui() { JFrame f = new JFrame(); f.setLayout(new BorderLayout()); f.add(createPanel(), BorderLayout.CENTER); f.setLocation(SGUI.calculateMiddlePosition(f)); f.pack(); f.setVisible(true); }
/** * */ public void createGui() { JFrame f = new JFrame(); f.setLayout(new BorderLayout()); f.add(createPanel(), BorderLayout.CENTER); f.setLocation(SGUI.calculateMiddlePosition(f)); f.pack(); f.setVisible(true); }
/** * */ public void createGui() { JFrame f = new JFrame(); f.setLayout(new BorderLayout()); f.add(createPanel(), BorderLayout.CENTER); f.setLocation(SGUI.calculateMiddlePosition(f)); f.pack(); f.setVisible(true); }
public void run() { ClasspathPanel classpath = new ClasspathPanel(); JTabbedPane tabs = new JTabbedPane(); tabs.addTab("Platform Config", new PlatformConfigPanel(classpath)); tabs.addTab("Classpath", classpath); JFrame f = new JFrame("Jadex Platform Configuration"); f.getContentPane().add(tabs, BorderLayout.CENTER); f.pack(); f.setLocation(SGUI.calculateMiddlePosition(f)); f.setVisible(true); } });
/** * Create a gui frame. */ public static void createGui(final IExternalAccess agent) { final JFrame f = new JFrame(); f.add(new DaemonPanel(agent)); f.pack(); f.setLocation(SGUI.calculateMiddlePosition(f)); f.setVisible(true); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { agent.killComponent(); } }); // todo: micro listener } }
/** * Create a gui frame. */ public static void createGui(final IExternalAccess agent) { final JFrame f = new JFrame(); f.add(new DaemonPanel(agent)); f.pack(); f.setLocation(SGUI.calculateMiddlePosition(f)); f.setVisible(true); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { agent.killComponent(); } }); // todo: micro listener } }
public void run() { JFrame f = new JFrame(); f.setLayout(new BorderLayout()); PlayerPanel pp = new PlayerPanel(ls); f.setContentPane(pp); f.pack(); f.setLocation(SGUI.calculateMiddlePosition(f)); f.setVisible(true); ret.setResult(pp); } });
/** * Overrides normal setVisible to auto-adjust the * dialogs position to the center of the owner frame. * @param show True, for showing. */ public void setVisible(boolean show) { if(show) { setLocation(SGUI.calculateMiddlePosition(this.getOwner(), this)); super.setVisible(show); } else { super.setVisible(show); } } }
/** * Main for testing. */ public static void main(String[] args) { Board b = new Board(5); BoardPanel bp = new BoardPanel(b); bp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Action event: "+e); } }); JFrame f = new JFrame(); f.getContentPane().add("Center", bp); f.setSize(400,400); f.setLocation(SGUI.calculateMiddlePosition(f)); f.setVisible(true); } }
public boolean requestInput(long currenttime) { if(e!=null) { throw new RuntimeException(e); } else { this.deadline.setText(dformat.format(new Date(currenttime + 300000))); this.aborted = true; this.pack(); this.setLocation(SGUI.calculateMiddlePosition(getFrame(), this)); this.setVisible(true); return !aborted; } } }
public boolean requestInput(long currenttime) { if(e!=null) { throw new RuntimeException(e); } else { this.deadline.setText(dformat.format(new Date(currenttime + 300000))); this.aborted = true; this.pack(); this.setLocation(SGUI.calculateMiddlePosition(getFrame(), this)); this.setVisible(true); return !aborted; } } }
public void run() { finishwait = new JButton("Notify process thread"); finishwait.setEnabled(false); finishwait.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(notifier!=null) { notifier.notify(null); NotifierFrame.this.dispose(); } } }); getContentPane().setLayout(new BorderLayout()); getContentPane().add(finishwait, BorderLayout.CENTER); pack(); setLocation(SGUI.calculateMiddlePosition(NotifierFrame.this)); setVisible(true); } });
/** * Create a new gui. */ public TranslationGuiF1() { // create the gui. tadata = new DefaultTableModel(new String[]{"Action", "Language", "Content", "Translation"}, 0); JTable tatable = new JTable(tadata); JScrollPane sp = new JScrollPane(tatable); this.getContentPane().add("Center", sp); this.pack(); this.setLocation(SGUI.calculateMiddlePosition(this)); this.setVisible(true); }
public void actionPerformed(ActionEvent e) { if(alarms_gui==null || !alarms_gui.isVisible()) { alarms_gui = new AlarmsGui(ClockFrame.this.agent); alarms_gui.pack(); alarms_gui.setLocation(SGUI.calculateMiddlePosition(alarms_gui)); alarms_gui.setVisible(true); } } };
public void actionPerformed(ActionEvent e) { if(alarms_gui==null || !alarms_gui.isVisible()) { alarms_gui = new AlarmsGui(ClockFrame.this.agent); alarms_gui.pack(); alarms_gui.setLocation(SGUI.calculateMiddlePosition(alarms_gui)); alarms_gui.setVisible(true); } } };
/** * Main for testing. */ public static void main(String[] args) { MapPanel mp = new MapPanel(); Frame f = new Frame(); f.add("Center", mp); f.pack(); f.setLocation(SGUI.calculateMiddlePosition(f)); f.setVisible(true); } }
/** * Show the dialog and return the result. * @param owner The owner. * @param alarm The alarm. * @return The new alarm or null. */ public static Alarm showDialog(IExternalAccess agent, JFrame owner, Alarm alarm) { Alarm ret = null; AlarmSettingsDialog asd = new AlarmSettingsDialog(agent, owner, alarm); asd.pack(); asd.setLocation(SGUI.calculateMiddlePosition(owner, asd)); asd.setVisible(true); if(asd.isStateOk()) ret = asd.getAlarm(); return ret; }
/** * Show the dialog and return the result. * @param owner The owner. * @param alarm The alarm. * @return The new alarm or null. */ public static Alarm showDialog(IExternalAccess agent, JFrame owner, Alarm alarm) { Alarm ret = null; AlarmSettingsDialog asd = new AlarmSettingsDialog(agent, owner, alarm); asd.pack(); asd.setLocation(SGUI.calculateMiddlePosition(owner, asd)); asd.setVisible(true); if(asd.isStateOk()) ret = asd.getAlarm(); return ret; }