List of usage examples for java.awt GridLayout GridLayout
public GridLayout(int rows, int cols)
From source file:Main.java
public UnicodeJFrame() { super("Demonstrating Unicode"); setLayout(new GridLayout(8, 1)); JLabel englishJLabel = new JLabel( "\u0057\u0065\u006C\u0063" + "\u006F\u006D\u0065\u0020\u0074\u006F\u0020Unicode\u0021"); englishJLabel.setToolTipText("This is English"); add(englishJLabel);//from ww w.j av a 2s .c om JLabel chineseJLabel = new JLabel("\u6B22\u8FCE\u4F7F\u7528" + "\u0020\u0020Unicode\u0021"); chineseJLabel.setToolTipText("This is Traditional Chinese"); add(chineseJLabel); JLabel cyrillicJLabel = new JLabel( "\u0414\u043E\u0431\u0440" + "\u043E\u0020\u043F\u043E\u0436\u0430\u043B\u043E\u0432" + "\u0430\u0422\u044A\u0020\u0432\u0020Unicode\u0021"); cyrillicJLabel.setToolTipText("This is Russian"); add(cyrillicJLabel); JLabel frenchJLabel = new JLabel( "\u0042\u0069\u0065\u006E\u0076" + "\u0065\u006E\u0075\u0065\u0020\u0061\u0075\u0020Unicode\u0021"); frenchJLabel.setToolTipText("This is French"); add(frenchJLabel); JLabel germanJLabel = new JLabel( "\u0057\u0069\u006C\u006B\u006F" + "\u006D\u006D\u0065\u006E\u0020\u007A\u0075\u0020Unicode\u0021"); germanJLabel.setToolTipText("This is German"); add(germanJLabel); JLabel japaneseJLabel = new JLabel("Unicode\u3078\u3087\u3045" + "\u3053\u305D\u0021"); japaneseJLabel.setToolTipText("This is Japanese"); add(japaneseJLabel); JLabel portugueseJLabel = new JLabel("\u0053\u00E9\u006A\u0061" + "\u0020\u0042\u0065\u006D\u0076\u0069\u006E\u0064\u006F\u0020" + "Unicode\u0021"); portugueseJLabel.setToolTipText("This is Portuguese"); add(portugueseJLabel); JLabel spanishJLabel = new JLabel("\u0042\u0069\u0065\u006E" + "\u0076\u0065\u006E\u0069\u0064\u0061\u0020\u0061\u0020" + "Unicode\u0021"); spanishJLabel.setToolTipText("This is Spanish"); add(spanishJLabel); }
From source file:Main.java
public Main() { this.setLayout(new GridLayout(0, 1)); this.add(init(a)); this.add(init(b)); sum.setEditable(false);/* www . j a va 2 s . c o m*/ sum.setFocusable(false); this.add(sum); }
From source file:AlignLabels.java
public AlignLabels() { JLabel label;//w w w .java2 s . c o m setLayout(new GridLayout(3, 3)); label = createLabel("NW alignment"); setNWalignment(label); label.setEnabled(false); labels[0] = label; label = createLabel("N alignment"); setNalignment(label); labels[1] = label; label = createLabel("NE alignment"); setNEalignment(label); labels[2] = label; label = createLabel("W alignment"); label.setText("<html><i>html based<br></i><font color=blue>W alignment</font>"); setWalignment(label); labels[3] = label; label = createLabel("C alignment"); setCalignment(label); label.setEnabled(false); labels[4] = label; label = createLabel("E alignment"); setEalignment(label); labels[5] = label; label = createLabel("SW alignment"); setSWalignment(label); labels[6] = label; label = createLabel("S alignment"); setSalignment(label); labels[7] = label; label = createLabel("SE alignment"); setSEalignment(label); label.setEnabled(false); labels[8] = label; }
From source file:Main.java
public Main() { JPanel sliderPanel = new JPanel(); sliderPanel.setLayout(new GridLayout(0, 1)); for (int i = 0; i < slider.length; i++) { labels[i] = new Label(colorNames[i] + 255); sliderPanel.add(labels[i]);/*w ww. j a v a2s. c o m*/ slider[i] = new JSlider(SwingConstants.HORIZONTAL, 0, 255, 255); slider[i].setMinorTickSpacing(10); slider[i].setMajorTickSpacing(50); slider[i].setPaintTicks(true); slider[i].setPaintLabels(true); sliderPanel.add(slider[i]); } lb = new Label("Colour"); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setModal(true); dialog.add(sliderPanel, BorderLayout.CENTER); dialog.add(lb, BorderLayout.SOUTH); dialog.pack(); dialog.setLocation(200, 200); dialog.setTitle("Colour Dialog"); dialog.setVisible(true); }
From source file:Main.java
public Main() { super("JSpinner Icon Test"); setSize(300, 80);//ww w. j a v a 2 s. c o m setDefaultCloseOperation(EXIT_ON_CLOSE); Container c = getContentPane(); c.setLayout(new GridLayout(0, 2)); Icon nums[] = new Icon[] { new ImageIcon("1.gif"), new ImageIcon("2.gif"), new ImageIcon("3.gif"), new ImageIcon("4.gif"), new ImageIcon("5.gif"), new ImageIcon("6.gif") }; JSpinner s1 = new JSpinner(new SpinnerListModel(nums)); s1.setEditor(new IconEditor(s1)); System.out.println(s1.getEditor()); c.add(new JLabel(" Icon Spinner")); c.add(s1); setVisible(true); }
From source file:MainClass.java
public MainClass() { super("JSpinner Icon Test"); setSize(300, 80);/* w w w . ja va 2s . c o m*/ setDefaultCloseOperation(EXIT_ON_CLOSE); Container c = getContentPane(); c.setLayout(new GridLayout(0, 2)); Icon nums[] = new Icon[] { new ImageIcon("1.gif"), new ImageIcon("2.gif"), new ImageIcon("3.gif"), new ImageIcon("4.gif"), new ImageIcon("5.gif"), new ImageIcon("6.gif") }; JSpinner s1 = new JSpinner(new SpinnerListModel(nums)); s1.setEditor(new IconEditor(s1)); c.add(new JLabel(" Icon Spinner")); c.add(s1); setVisible(true); }
From source file:Main.java
public TwoRoot() { setLayout(new GridLayout(0, 1)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(progressBar);//w w w. j av a 2 s . com add(label); setSize(300, 100); setVisible(true); progressBar.setIndeterminate(true); TwoWorker task = new TwoWorker(); task.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { if ("progress".equals(e.getPropertyName())) { progressBar.setIndeterminate(false); progressBar.setValue((Integer) e.getNewValue()); } } }); task.execute(); }
From source file:Main.java
public Main() { setLayout(new GridLayout(0, 1)); DefaultComboBoxModel<ComboColor> cModel = new DefaultComboBoxModel<>(ComboColor.values()); JComboBox<ComboColor> combo = new JComboBox<>(cModel); add(createComboLabelPanel(1, combo)); comboList.add(combo);/* w w w . j ava 2 s. co m*/ }
From source file:Main.java
public void buildChooser() { setLayout(new GridLayout(0, 3)); makeAddButton("Red", Color.red); makeAddButton("Green", Color.green); makeAddButton("Blue", Color.blue); }
From source file:TRescaleOp.java
public TRescaleOp() { super();/*from ww w. ja v a 2 s . c o m*/ Container container = getContentPane(); displayPanel = new DisplayPanel(); container.add(displayPanel); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(2, 2)); panel.setBorder(new TitledBorder("Click a Button to Perform the Associated Operation...")); brightenButton = new JButton("Brightness >>"); brightenButton.addActionListener(new ButtonListener()); darkenButton = new JButton("Brightness <<"); darkenButton.addActionListener(new ButtonListener()); contIncButton = new JButton("Contrast >>"); contIncButton.addActionListener(new ButtonListener()); contDecButton = new JButton("Contrast <<"); contDecButton.addActionListener(new ButtonListener()); panel.add(brightenButton); panel.add(darkenButton); panel.add(contIncButton); panel.add(contDecButton); container.add(BorderLayout.SOUTH, panel); addWindowListener(new WindowEventHandler()); setSize(displayPanel.getWidth(), displayPanel.getHeight() + 10); show(); // Display the frame }