List of usage examples for java.awt BorderLayout BorderLayout
public BorderLayout()
From source file:ContextMenu.java
public ContextMenu() { final JPopupMenu contextMenu = new JPopupMenu("Edit"); contextMenu.add(makeMenuItem("Save")); contextMenu.add(makeMenuItem("Save As")); contextMenu.add(makeMenuItem("Close")); JFrame frame = new JFrame(); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); frame.add(panel);/*from www .j a va 2 s . c o m*/ panel.setComponentPopupMenu(contextMenu); textArea.setInheritsPopupMenu(true); panel.add(BorderLayout.CENTER, textArea); JTextField textField = new JTextField(); textField.setInheritsPopupMenu(true); panel.add(BorderLayout.SOUTH, textField); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 200); frame.setVisible(true); }
From source file:Rotation.java
public void init() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); canvas3D = new Canvas3D(config); add("Center", canvas3D); BranchGroup szene = macheSzene();/*from www . j a va2 s.c o m*/ szene.compile(); universe = new SimpleUniverse(canvas3D); universe.getViewingPlatform().setNominalViewingTransform(); universe.addBranchGraph(szene); }
From source file:MainClass.java
public MainClass() throws Exception { getContentPane().setLayout(new BorderLayout()); Object[][] data = { { "A", "B", "C", new Integer(5), new Boolean(false) }, { "D", "E", "F", new Integer(3), new Boolean(true) } }; String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian" }; table = new JTable(data, columnNames); JPanel tPanel = new JPanel(new BorderLayout()); tPanel.add(table.getTableHeader(), BorderLayout.NORTH); tPanel.add(table, BorderLayout.CENTER); getContentPane().add(tPanel, BorderLayout.CENTER); Document document = new Document(); PdfWriter writer;//from w w w . j a v a 2 s .c om writer = PdfWriter.getInstance(document, new FileOutputStream("my_jtable_shapes.pdf")); // writer = PdfWriter.getInstance(document, new // FileOutputStream("my_jtable_fonts.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(500, 500); Graphics2D g2; g2 = tp.createGraphicsShapes(500, 500); // g2 = tp.createGraphics(500, 500); table.print(g2); g2.dispose(); cb.addTemplate(tp, 30, 300); // step 5: we close the document document.close(); }
From source file:Main.java
TabView() { tabbedPane.addTab("Hello", new JLabel("World")); tabbedPane.addTab("Goodbye", new JLabel("Sunshine")); setLayout(new BorderLayout()); tabbedPane.setTabPlacement(JTabbedPane.TOP); tabbedPane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT); add(tabbedPane, BorderLayout.CENTER); }
From source file:Main.java
public Main() { JPanel holderPanel = new JPanel(new BorderLayout()); holderPanel.add(thumbPanel, BorderLayout.NORTH); holderPanel.add(Box.createGlue(), BorderLayout.CENTER); setLayout(new BorderLayout()); add(new JScrollPane(holderPanel), BorderLayout.CENTER); }
From source file:Main.java
public Main() { setLayout(new BorderLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(500, 200);//from w ww. ja v a2s . co m add(createToolBar(), BorderLayout.PAGE_START); setVisible(true); }
From source file:ToolBarwithCheckBox.java
public ToolbarPanel() { setLayout(new BorderLayout()); JToolBar toolbar = new JToolBar(); for (int i = 1; i < 4; i++) { JCheckBox cbox = new JCheckBox("Checkbox #" + i); toolbar.add(cbox);/*from w ww .j a v a 2 s.com*/ cbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) (e.getSource()); System.out.println("Toolbar " + source.getText()); } }); } add(toolbar, BorderLayout.NORTH); }
From source file:Main.java
public Main() { JEditorPane editorPane = new JEditorPane(); JScrollPane scrollPane = new JScrollPane(); this.setPreferredSize(new Dimension(300, 300)); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); editorPane.setEditorKit(new PreWrapHTMLEditorKit()); editorPane.setText("" + "<html>" + "<head></head>" + "<body>" + "<pre>long text line long text line long text line long text line (two new lines here!)\n\n" + "long text line long text line long text line long text line long text line long text line</pre>" + "</body>" + "</html>"); scrollPane.setViewportView(editorPane); getContentPane().add(scrollPane);/*from ww w . jav a2 s. c o m*/ pack(); }
From source file:Main.java
public Main(File dir) { setLayout(new BorderLayout()); JTree tree = new JTree(addNodes(null, projectFile)); tree.setCellRenderer(new MyTreeCellRenderer()); tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getPath().getLastPathComponent(); System.out.println("You selected " + node); }//from ww w . j a v a2s.co m }); JScrollPane scrollpane = new JScrollPane(); scrollpane.getViewport().add(tree); add(scrollpane, BorderLayout.CENTER); }
From source file:Main.java
public Main() { String[] comboTypes = { "Numbers", "Alphabets", "Symbols" }; JComboBox<String> comboTypesList = new JComboBox<>(comboTypes); comboTypesList.setSelectedIndex(2);//from www . jav a 2s.c o m comboTypesList.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JComboBox jcmbType = (JComboBox) e.getSource(); String cmbType = (String) jcmbType.getSelectedItem(); System.out.println(cmbType); } }); setLayout(new BorderLayout()); add(comboTypesList, BorderLayout.NORTH); }