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:AnEtchedBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Etched Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = new EtchedBorder(EtchedBorder.RAISED); Border loweredBorder = new EtchedBorder(EtchedBorder.LOWERED); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2, 5, 5)); contentPane.add(raisedButton);// w ww. ja v a2s .c o m contentPane.add(loweredButton); frame.setSize(300, 100); frame.setVisible(true); }
From source file:ASoftBevelBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Soft Bevel Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = new SoftBevelBorder(SoftBevelBorder.RAISED); Border loweredBorder = new SoftBevelBorder(SoftBevelBorder.LOWERED); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2)); contentPane.add(raisedButton);/*from w ww. j a va 2 s .co m*/ contentPane.add(loweredButton); frame.setSize(300, 100); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { 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.pack();//from w w w . ja v a 2 s. c o m frame.setSize(300, frame.getHeight()); 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 thickBorder = new LineBorder(Color.WHITE, 12); JButton thickButton = new JButton("12 Pixel"); thickButton.setBorder(thickBorder); Container contentPane = frame.getContentPane(); contentPane.add(thickButton, BorderLayout.NORTH); frame.pack();/*from www . j a v a 2 s . c o m*/ frame.setSize(300, frame.getHeight()); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] a) { JFrame frame = new JFrame("Soft Bevel Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = new SoftBevelBorder(SoftBevelBorder.RAISED); Border loweredBorder = new SoftBevelBorder(SoftBevelBorder.LOWERED); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2)); contentPane.add(raisedButton);/*from w w w. j ava2s .c om*/ contentPane.add(loweredButton); frame.setSize(300, 100); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] a) { JFrame frame = new JFrame("Etched Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = new EtchedBorder(EtchedBorder.RAISED); Border loweredBorder = new EtchedBorder(EtchedBorder.LOWERED); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2, 5, 5)); contentPane.add(raisedButton);/*from w w w .j av a 2 s . c om*/ contentPane.add(loweredButton); frame.setSize(300, 100); 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 myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED); JButton myRaisedButton = new JButton("My Raised"); myRaisedButton.setBorder(myRaisedBorder); Container contentPane = frame.getContentPane(); contentPane.add(myRaisedButton);/*www. j a v a 2 s. 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 myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED); JButton myRaisedButton = new JButton("My Raised"); myRaisedButton.setBorder(myRaisedBorder); Container contentPane = frame.getContentPane(); contentPane.add(myRaisedButton);/*from w w w . ja v a 2 s . c om*/ 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.pack();/*from w w w . j a v a 2 s .c o m*/ frame.setSize(300, frame.getHeight()); 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 myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED, Color.PINK, Color.RED); JButton myRaisedButton = new JButton("My Raised"); myRaisedButton.setBorder(myRaisedBorder); Container contentPane = frame.getContentPane(); contentPane.add(myRaisedButton);/*from w w w. j a v a2 s . c o m*/ frame.setSize(300, 200); frame.setVisible(true); }