Tabnine Logo
JFrame.setLocation
Code IndexAdd Tabnine to your IDE (free)

How to use
setLocation
method
in
javax.swing.JFrame

Best Java code snippets using javax.swing.JFrame.setLocation (Showing top 20 results out of 1,611)

Refine searchRefine arrow

  • JFrame.setVisible
  • JFrame.<init>
origin: jMonkeyEngine/jmonkeyengine

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);
}

origin: pmd/pmd

frame.setLocation((screenWidth - frame.getWidth()) / 2, (screenHeight - frame.getHeight()) / 2);
frame.setVisible(true);
int horozontalMiddleLocation = controlSplitPane.getMaximumDividerLocation() * 3 / 5;
controlSplitPane.setDividerLocation(horozontalMiddleLocation);
origin: fossasia/neurolab-desktop

gameFrame = new JFrame("Neurofeedback Game");
gameFrame.addWindowListener(new WindowAdapter() {
  public void windowClosing(WindowEvent windowevent) {
gameFrame.setLocation((width / 10), (height / 10));
gameFrame.setAlwaysOnTop(true);
origin: stackoverflow.com

 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);

  }

}
origin: stackoverflow.com

 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);
  }

}
origin: pmd/pmd

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);
}
origin: i2p/i2p.i2p

  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();
  }
});
origin: stackoverflow.com

private static void createAndShowGUI() {
 //Create and set up the window.
 JFrame frame = new JFrame("HelloWorldSwing");
 frame.setLocation (50, 50);
 ...
origin: wildfly/wildfly

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();
}
origin: RaiMan/SikuliX2

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");
origin: stackoverflow.com

JFrame fr=new JFrame();
fr.setLocation(position1);
origin: wildfly/wildfly

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();
origin: sc.fiji/Cell_Counter

  @Override
  public void run() {
    jFrame.pack();
    jFrame.setLocation(1000, 200);
    jFrame.setVisible(true);
  }
}
origin: stackoverflow.com

 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);
origin: wildfly/wildfly

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();
origin: IanDarwin/javasrc

/** "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);
}
origin: IanDarwin/javasrc

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();
}
origin: igniterealtime/Smack

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);
origin: stackoverflow.com

 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);
}
origin: stackoverflow.com

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);
javax.swingJFramesetLocation

Popular methods of JFrame

  • <init>
  • setVisible
  • setDefaultCloseOperation
  • pack
  • getContentPane
  • setSize
  • add
  • addWindowListener
  • dispose
  • setTitle
  • setContentPane
  • setLocationRelativeTo
  • setContentPane,
  • setLocationRelativeTo,
  • setJMenuBar,
  • setLayout,
  • setResizable,
  • setIconImage,
  • setBounds,
  • getRootPane,
  • getSize

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • requestLocationUpdates (LocationManager)
  • putExtra (Intent)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Option (scala)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now