List of usage examples for javax.swing JButton setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Double Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TitledBorder topBorder = BorderFactory.createTitledBorder("Top"); topBorder.setTitlePosition(TitledBorder.TOP); TitledBorder doubleBorder = new TitledBorder(topBorder, "Bottom", TitledBorder.RIGHT, TitledBorder.BOTTOM); JButton doubleButton = new JButton(); doubleButton.setBorder(doubleBorder); Container contentPane = frame.getContentPane(); contentPane.add(doubleButton, BorderLayout.CENTER); frame.setSize(300, 100);//from www. j a v a 2 s .c o m frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("Color Matted Border"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border solidBorder = new MatteBorder(10, 5, 2, 20, Color.RED); JButton solidButton = new JButton("10x5x2x20"); solidButton.setBorder(solidBorder); Container contentPane = frame.getContentPane(); contentPane.add(solidButton, BorderLayout.CENTER); frame.setSize(300, 100);/* www .ja v a 2s . co m*/ frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Positioned Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TitledBorder aboveBottomBorder = BorderFactory.createTitledBorder("AboveBottom"); aboveBottomBorder.setTitlePosition(TitledBorder.ABOVE_BOTTOM); JButton aboveBottomButton = new JButton(); aboveBottomButton.setBorder(aboveBottomBorder); Container contentPane = frame.getContentPane(); contentPane.add(aboveBottomButton);// ww w .j av a 2 s . c o m frame.setSize(300, 200); frame.setVisible(true); }
From source file:DoubleTitle.java
public static void main(String args[]) { JFrame frame = new JFrame("Double Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TitledBorder topBorder = BorderFactory.createTitledBorder("Top"); topBorder.setTitlePosition(TitledBorder.TOP); TitledBorder doubleBorder = new TitledBorder(topBorder, "Bottom", TitledBorder.RIGHT, TitledBorder.BOTTOM); JButton doubleButton = new JButton(); doubleButton.setBorder(doubleBorder); Container contentPane = frame.getContentPane(); contentPane.add(doubleButton, BorderLayout.CENTER); frame.setSize(300, 100);/*from w w w .j a v a 2 s. c om*/ frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Justified Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = BorderFactory.createRaisedBevelBorder(); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); Container contentPane = frame.getContentPane(); contentPane.add(raisedButton);//w w w. j a v a 2s .co m frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame("Justified Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = BorderFactory.createRaisedSoftBevelBorder(); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); Container contentPane = frame.getContentPane(); contentPane.add(raisedButton);//from www . ja va 2s. c o m frame.setSize(300, 200); frame.setVisible(true); }
From source file:AnEmptyBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Empty Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border emptyBorder = BorderFactory.createEmptyBorder(20, 20, 0, 0); JButton emptyButton = new JButton("With Empty"); emptyButton.setBorder(emptyBorder); JButton nonemptyButton = new JButton("Without Empty"); Container contentPane = frame.getContentPane(); contentPane.add(emptyButton, BorderLayout.NORTH); contentPane.add(nonemptyButton, BorderLayout.SOUTH); frame.setSize(300, 100);//from ww w. j ava 2 s . c o m frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame("Justified Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border loweredBorder = BorderFactory.createLoweredSoftBevelBorder(); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.add(loweredButton);/*from w w w .j av a 2s.c om*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame("Justified Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border loweredBorder = BorderFactory.createLoweredBevelBorder(); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.add(loweredButton);/*www . j a va2 s . c o m*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Line Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border thinBorder = LineBorder.createBlackLineBorder(); JButton thinButton = new JButton("1 Pixel"); thinButton.setBorder(thinBorder); Container contentPane = frame.getContentPane(); contentPane.add(thinButton, BorderLayout.NORTH); frame.pack();// ww w . j a v a 2 s . c o m frame.setSize(300, frame.getHeight()); frame.setVisible(true); }