List of usage examples for javax.swing JFrame setLocationRelativeTo
public void setLocationRelativeTo(Component c)
From source file:Main.java
public static void main(String[] args) { String[] items = { "Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat" }; JList<String> myJList = new JList(items) { @Override/* w ww. j a v a 2s . c o m*/ protected void processMouseEvent(MouseEvent e) { int modifiers = e.getModifiers() | InputEvent.CTRL_MASK; int modifiersEx = e.getModifiersEx() | InputEvent.CTRL_MASK; MouseEvent myME = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), modifiers, e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); super.processMouseEvent(myME); } }; JFrame f = new JFrame(); f.add(new JScrollPane(myJList)); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new TextStyleTestFrame(); frame.setSize(300, 300);// ww w .j ava 2 s . c om frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:LinesDashes3.java
public static void main(String[] args) { LinesDashes3 lines = new LinesDashes3(); JFrame frame = new JFrame("Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(lines);/*from w ww . j av a 2 s . co m*/ frame.setSize(280, 270); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:LinesDashes2.java
public static void main(String[] args) { LinesDashes2 lines = new LinesDashes2(); JFrame frame = new JFrame("Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(lines);//from ww w . j av a 2s . c o m frame.setSize(280, 270); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:LinesDashes4.java
public static void main(String[] args) { LinesDashes4 lines = new LinesDashes4(); JFrame frame = new JFrame("Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(lines);/*from w w w. ja va2 s . co m*/ frame.setSize(280, 270); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:LinesDashes1.java
public static void main(String[] args) { LinesDashes1 lines = new LinesDashes1(); JFrame frame = new JFrame("Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(lines);//from w w w. jav a 2s . co m frame.setSize(280, 270); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Rectangles.java
public static void main(String[] args) { Rectangles rects = new Rectangles(); JFrame frame = new JFrame("Rectangles"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(rects);/*from w w w. j a va2 s. com*/ frame.setSize(360, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:TreeSelectionOption.java
public static void main(String[] argv) { JTree tree = new JTree(); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(tree)); frame.setSize(380, 320);/*from w w w .ja va 2 s . co m*/ frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:GrayImage.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new GrayImage()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 400);/*from w w w .j a v a 2 s . co m*/ frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Text.java
public static void main(String[] args) { Text text = new Text(); JFrame frame = new JFrame("Sonnet 55"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(text);//ww w.j ava 2 s. c o m frame.setSize(500, 470); frame.setLocationRelativeTo(null); frame.setVisible(true); }