List of usage examples for java.awt FlowLayout FlowLayout
public FlowLayout()
From source file:MyLookAndFeel.java
public Main() throws Exception { UIManager.setLookAndFeel("MyLookAndFeel"); setLayout(new FlowLayout()); JButton b = new JButton(); b.setText("<html>A<br> B</html>"); b.setToolTipText("<html>C<br>D<br>E</html>"); add(b);// w w w . j a v a 2 s. c o m JLabel l = new JLabel("Z"); l.setToolTipText("zzzzz..."); add(l); }
From source file:Main.java
public Main() { setLayout(new BorderLayout()); setSize(300, 300);/*from ww w . java2s.c o m*/ setVisible(true); JPanel p = new JPanel(new FlowLayout()); p.add(b); p.add(b1); add(p, BorderLayout.SOUTH); b.addActionListener(this); b1.addActionListener(this); m = new ImageIcon[2]; m[0] = new ImageIcon("m.jpg"); m[1] = new ImageIcon("m1.jpg"); l = new JLabel(); l.setBounds(400, 0, getWidth(), getHeight()); add(l, BorderLayout.CENTER); l.setIcon(m[0]); }
From source file:Test.java
public Test() { this.setBounds(100, 100, 200, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createLoweredSoftBevelBorder()); this.setLayout(new FlowLayout()); JButton exitButton = new JButton("Exit"); panel.add(exitButton);/*from ww w. j a v a 2 s . c o m*/ this.add(panel); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); }
From source file:Test.java
public Test() { this.setBounds(100, 100, 200, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1, true)); this.setLayout(new FlowLayout()); JButton exitButton = new JButton("Exit"); panel.add(exitButton);/*from w w w . j a v a 2s . c om*/ this.add(panel); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); }
From source file:MyDialog.java
public MyDialog(JFrame parent) { super(parent, "My dialog", true); Container cp = getContentPane(); cp.setLayout(new FlowLayout()); cp.add(new JLabel("Here is my dialog")); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); // Closes the dialog }// www. j ava2 s . c o m }); cp.add(ok); setSize(150, 125); }
From source file:Test.java
public Test() { this.setSize(200, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new FlowLayout()); JColorChooser.showDialog(this, null, Color.blue); JButton printDialogButton = new JButton("Print Dialog"); printDialogButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { final PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); attributes.add(DialogTypeSelection.COMMON); PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.printDialog(attributes); }//from w w w .j av a 2 s. c o m }); this.add(printDialogButton); }
From source file:Test.java
public Test() { this.setBounds(100, 100, 200, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED)); // panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED)); this.setLayout(new FlowLayout()); JButton exitButton = new JButton("Exit"); panel.add(exitButton);//from ww w . ja v a2 s . co m this.add(panel); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); }
From source file:MainClass.java
public MainClass() { theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); cp = theFrame.getContentPane();/*from w w w . ja v a 2 s . co m*/ cp.setLayout(new FlowLayout()); ButtonGroup bg = new ButtonGroup(); JRadioButton bJava = new JRadioButton("Java"); bJava.addActionListener(new LNFSetter("javax.swing.plaf.metal.MetalLookAndFeel", bJava)); bg.add(bJava); cp.add(bJava); JRadioButton bMSW = new JRadioButton("MS-Windows"); bMSW.addActionListener(new LNFSetter("com.sun.java.swing.plaf.windows.WindowsLookAndFeel", bMSW)); bg.add(bMSW); cp.add(bMSW); JRadioButton bMotif = new JRadioButton("Motif"); bMotif.addActionListener(new LNFSetter("com.sun.java.swing.plaf.motif.MotifLookAndFeel", bMotif)); bg.add(bMotif); cp.add(bMotif); JRadioButton bMac = new JRadioButton("Sun-MacOS"); bMac.addActionListener(new LNFSetter("com.sun.java.swing.plaf.mac.MacLookAndFeel", bMac)); bg.add(bMac); cp.add(bMac); String defaultLookAndFeel = UIManager.getSystemLookAndFeelClassName(); JRadioButton bDefault = new JRadioButton("Default"); bDefault.addActionListener(new LNFSetter(defaultLookAndFeel, bDefault)); bg.add(bDefault); cp.add(bDefault); (previousButton = bDefault).setSelected(true); theFrame.pack(); theFrame.setVisible(true); }
From source file:MainClass.java
public JPanel createNested(boolean opaque) { JPanel outer = new JPanel(new FlowLayout()); JPanel inner = new JPanel(new FlowLayout()); outer.setBackground(Color.white); inner.setBackground(Color.black); inner.setOpaque(opaque);/*from w ww . j a v a 2 s.co m*/ inner.setBorder(BorderFactory.createLineBorder(Color.gray)); inner.add(new JButton("Button")); outer.add(inner); return outer; }
From source file:Main.java
Main() { JFrame jfrm = new JFrame("JTable Demo"); jfrm.setLayout(new FlowLayout()); jfrm.setSize(460, 180);/*from w ww. j ava2s . c o m*/ jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JScrollPane jscrlp = new JScrollPane(jtabOrders); jtabOrders.setPreferredScrollableViewportSize(new Dimension(420, 60)); jtabOrders.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jfrm.setVisible(true); jtabOrders.setColumnSelectionAllowed(false); jtabOrders.setRowSelectionAllowed(true); }