Refine search
private static void createWindowForPanel(AwtPanel panel, int location){ JFrame frame = new JFrame("Render Display " + location); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(panel, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { if (++panelsClosed == 2){ app.stop(); } } }); frame.pack(); frame.setLocation(location, Toolkit.getDefaultToolkit().getScreenSize().height - 400); frame.setVisible(true); }
frame.setLocation((screenWidth - frame.getWidth()) / 2, (screenHeight - frame.getHeight()) / 2); frame.setVisible(true); int horozontalMiddleLocation = controlSplitPane.getMaximumDividerLocation() * 3 / 5; controlSplitPane.setDividerLocation(horozontalMiddleLocation);
gameFrame = new JFrame("Neurofeedback Game"); gameFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowevent) { gameFrame.setLocation((width / 10), (height / 10)); gameFrame.setAlwaysOnTop(true);
public class Test { public static void main (String[] args) { JFrame f1 = new JFrame(); f1. setSize(100, 100); f1.setLocationRelativeTo(null); f1.setVisible(true); JFrame f2 = new JFrame(); f2.setSize(100, 100); f2.setLocation(f1.getX() + f1.getWidth(), f1.getY()); f2.setVisible(true); } }
class GUI implements Runnable { public static void main(String[] args) { EventQueue.invokeLater(new GUI()); } @Override public void run() { JFrame myFrame = new JFrame("Frame Title"); myFrame.setLocation(new Point(100, 100)); myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); myFrame.getContentPane().add(mainPanel); mainPanel.add(new JButton("Button Text"), BorderLayout.CENTER); myFrame.pack(); myFrame.setLocationByPlatform(true); myFrame.setVisible(true); } }
private void createRuleXML() { CreateXMLRulePanel rulePanel = new CreateXMLRulePanel(xpathQueryArea, codeEditorPane); JFrame xmlframe = new JFrame("Create XML Rule"); xmlframe.setContentPane(rulePanel); xmlframe.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); xmlframe.setSize(new Dimension(600, 700)); xmlframe.addComponentListener(new java.awt.event.ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { JFrame tmp = (JFrame) e.getSource(); if (tmp.getWidth() < 600 || tmp.getHeight() < 700) { tmp.setSize(600, 700); } } }); int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; xmlframe.pack(); xmlframe.setLocation((screenWidth - xmlframe.getWidth()) / 2, (screenHeight - xmlframe.getHeight()) / 2); xmlframe.setVisible(true); }
private void handle(MouseEvent e) { //System.out.println("Button " + e.getButton() + " Frame was visible? " + // frame.isVisible() + " menu was visible? " + menu.isVisible() + // " trigger? " + menu.isPopupTrigger(e)); // http://stackoverflow.com/questions/17258250/changing-the-laf-of-a-popupmenu-for-a-trayicon-in-java // menu visible check is never true if (!frame.isVisible() /* || !menu.isVisible() */ ) { frame.setLocation(e.getX(), e.getY()); frame.setVisible(true); menu.show(frame, 0, 0); } updateMenu(); } });
private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("HelloWorldSwing"); frame.setLocation (50, 50); ...
public void go() throws Exception { if(!no_channel && !use_state) channel.connect(cluster_name); mainFrame=new JFrame(); mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); panel=new DrawPanel(use_state); panel.setBackground(background_color); sub_panel=new JPanel(); mainFrame.getContentPane().add("Center", panel); clear_button=new JButton("Clear"); clear_button.setFont(default_font); clear_button.addActionListener(this); leave_button=new JButton("Leave"); leave_button.setFont(default_font); leave_button.addActionListener(this); sub_panel.add("South", clear_button); sub_panel.add("South", leave_button); mainFrame.getContentPane().add("South", sub_panel); mainFrame.setBackground(background_color); clear_button.setForeground(Color.blue); leave_button.setForeground(Color.blue); mainFrame.pack(); mainFrame.setLocation(15, 25); mainFrame.setBounds(new Rectangle(250, 250)); if(!no_channel && use_state) { channel.connect(cluster_name, null, state_timeout); } mainFrame.setVisible(true); setTitle(); }
contentPane.add(panel); frame.pack(); frame.setLocation(storyTopLeft.x, storyTopLeft.y); if (waitBefore > 0) { new Thread(new ShowWaitBefore(frame, waitBefore)).start(); } else { frame.setVisible(true); log.trace("Story frame visible");
JFrame fr=new JFrame(); fr.setLocation(position1);
stomp_client.subscribe(clients_dest); mainFrame=new JFrame(); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel=new DrawPanel(false); leave_button.setForeground(Color.blue); mainFrame.pack(); mainFrame.setLocation(15, 25); mainFrame.setBounds(new Rectangle(250, 250)); mainFrame.setVisible(true); setTitle();
@Override public void run() { jFrame.pack(); jFrame.setLocation(1000, 200); jFrame.setVisible(true); } }
Point location = MouseInfo.getPointerInfo().getLocation(); int x = (int) location.getX(); int y = (int) location.getY(); JFrame frame = new JFrame(); //this is just the initialization of the window frame.setLocation(x, y);
public void start() throws Exception { mainFrame=new JFrame("Chat demo"); mainFrame.setPreferredSize(new Dimension(600,600)); mainFrame.setBackground(Color.white); mainFrame.setLocation(15, 25); Dimension main_frame_size=mainFrame.getSize(); txtArea.setPreferredSize(new Dimension((int)(main_frame_size.width * 0.9), (int)(main_frame_size.height * 0.8))); mainFrame.setVisible(true); txtField.setFocusable(true); txtField.requestFocusInWindow();
/** "main program" method - construct and show */ public static void main(String[] av) { // create a MoreChoices object, tell it to show up JFrame jf = new MoreChoices(); jf.setLocation(100, 100); // get away from screen corner, // since on some OSes a main window at 0,0 may be // partly obscured (e.g. notebook with PowerPanel jf.setVisible(true); }
public EvalServer() throws java.rmi.RemoteException { super(); // System.out.println("In EvalServer constructor"); h = new HashMap<String,Evaluation>(); if (!isVisual) return; f = new JFrame("Daily Evaluation Server"); f.setLocation(100, 100); f.setContentPane(g = new Grapher()); f.pack(); }
JFrame window = new JFrame(); JPanel jp = new JPanel(); window.add(jp); window.setLocation(0, 0); window.setSize(600, 600); receiver.setVisible(true); window.setAlwaysOnTop(true); window.setVisible(true);
public static void main(String[] args) { JFrame c = new AppController("FilmDataBase"); c.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); c.setLocation(1600, 400); c.setSize(600, 200); c.setVisible(true); }
JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("MyFirstFrame"); frame.setBackground(Color.BLACK); frame.setLocation(0,0); frame.setSize(150,150);