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) { JFrame frame = new JFrame("GradientsRedYellow"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Main()); frame.setSize(350, 350);/* ww w . j a va 2 s .c om*/ frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Scale.java
public static void main(String[] args) { JFrame frame = new JFrame("Scaling"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Scale()); frame.setSize(330, 160);// w ww .j av a2s .co m frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Shear.java
public static void main(String[] args) { JFrame frame = new JFrame("Shearing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Shear()); frame.setSize(330, 270);//from w w w. java2 s . c o m frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Textures.java
public static void main(String[] args) { Textures rects = new Textures(); JFrame frame = new JFrame("Textures"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(rects);//w ww .j a v a2 s .c o m frame.setSize(360, 210); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
License:asdf
public static void main(String[] args) { JFrame frame = new JFrame("Basic Shapes"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Main()); frame.setSize(350, 250);/*w ww . j av a 2 s .c om*/ frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { String HTMLTEXT = "<html><head><style>.foot{color:red} .head{color:black}</style></head>" + "<span style='font-family:consolas'>java2s.com</span><br/>" + "<span style='font-family:tahoma'>java2s.com</span>"; JTextPane textPane1 = new JTextPane(); textPane1.setContentType("text/html"); textPane1.setText(HTMLTEXT);// w ww .ja v a 2 s .c om JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().add(new JScrollPane(textPane1)); f.setSize(320, 240); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:BasicShapes.java
public static void main(String[] args) { JFrame frame = new JFrame("Basic Shapes"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new BasicShapes()); frame.setSize(350, 250);/*from w w w.j ava 2s.com*/ frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:GradientsLine.java
public static void main(String[] args) { JFrame frame = new JFrame("GradientsLine"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new GradientsLine()); frame.setSize(350, 350);//from w w w. ja v a2s.com frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:TreeSingleSelection.java
public static void main(String[] argv) { JTree tree = new JTree(); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); JFrame frame = new JFrame("Tree single selection"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(tree)); frame.setSize(380, 320);/*from w ww . jav a 2 s.c om*/ frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:TreeNodeRemove.java
public static void main(String[] argv) { Vector<String> v = new Vector<String>(); v.add("a");/*from w w w. j ava2 s . co m*/ v.add("b"); v.add("c"); JTree tree = new JTree(v); DefaultTreeModel model = (DefaultTreeModel) tree.getModel(); int startRow = 0; String prefix = "b"; TreePath path = tree.getNextMatch(prefix, startRow, Position.Bias.Forward); MutableTreeNode node = (MutableTreeNode) path.getLastPathComponent(); model.removeNodeFromParent(node); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(tree)); frame.setSize(380, 320); frame.setLocationRelativeTo(null); frame.setVisible(true); }