List of usage examples for java.awt BorderLayout SOUTH
String SOUTH
To view the source code for java.awt BorderLayout SOUTH.
Click Source Link
From source file:SwingThreadingWait.java
public SwingThreadingWait() { super("Invoke & Wait"); JButton freezer = new JButton("Open File"); freezer.addActionListener(this); counter = new JLabel("Time elapsed: 0s"); add(freezer, BorderLayout.CENTER); add(counter, BorderLayout.SOUTH); pack();/*ww w. j av a 2 s.c o m*/ setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); }
From source file:WelcomeApplet.java
public void init() { EventQueue.invokeLater(new Runnable() {// w ww . j a va 2 s . c o m public void run() { setLayout(new BorderLayout()); JLabel label = new JLabel(getParameter("greeting"), SwingConstants.CENTER); label.setFont(new Font("Serif", Font.BOLD, 18)); add(label, BorderLayout.CENTER); JPanel panel = new JPanel(); JButton cayButton = new JButton("Cay Horstmann"); cayButton.addActionListener(makeAction("http://www.horstmann.com")); panel.add(cayButton); JButton garyButton = new JButton("Gary Cornell"); garyButton.addActionListener(makeAction("mailto:gary_cornell@apress.com")); panel.add(garyButton); add(panel, BorderLayout.SOUTH); } }); }
From source file:Main.java
public Main() throws Exception { ArrayList columnNames = new ArrayList(); ArrayList data = new ArrayList(); String url = "jdbc:mysql://localhost:3306/yourdb"; String userid = "root"; String password = "sesame"; String sql = "SELECT * FROM animals"; Connection connection = DriverManager.getConnection(url, userid, password); Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql); ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); for (int i = 1; i <= columns; i++) { columnNames.add(md.getColumnName(i)); }/*from w w w. j av a 2 s. co m*/ while (rs.next()) { ArrayList row = new ArrayList(columns); for (int i = 1; i <= columns; i++) { row.add(rs.getObject(i)); } data.add(row); } Vector columnNamesVector = new Vector(); Vector dataVector = new Vector(); for (int i = 0; i < data.size(); i++) { ArrayList subArray = (ArrayList) data.get(i); Vector subVector = new Vector(); for (int j = 0; j < subArray.size(); j++) { subVector.add(subArray.get(j)); } dataVector.add(subVector); } for (int i = 0; i < columnNames.size(); i++) columnNamesVector.add(columnNames.get(i)); JTable table = new JTable(dataVector, columnNamesVector) { public Class getColumnClass(int column) { for (int row = 0; row < getRowCount(); row++) { Object o = getValueAt(row, column); if (o != null) { return o.getClass(); } } return Object.class; } }; JScrollPane scrollPane = new JScrollPane(table); getContentPane().add(scrollPane); JPanel buttonPanel = new JPanel(); getContentPane().add(buttonPanel, BorderLayout.SOUTH); }
From source file:Main.java
public Main() { DefaultMutableTreeNode forums = new DefaultMutableTreeNode("B"); forums.add(new DefaultMutableTreeNode("T")); DefaultMutableTreeNode articles = new DefaultMutableTreeNode("A"); articles.add(new DefaultMutableTreeNode("A")); DefaultMutableTreeNode examples = new DefaultMutableTreeNode("E"); examples.add(new DefaultMutableTreeNode("E")); rootNode.add(forums);/*from w w w . jav a 2 s.co m*/ rootNode.add(articles); rootNode.add(examples); m_tree.setEditable(true); m_tree.setSelectionRow(0); JScrollPane scrollPane = new JScrollPane(m_tree); getContentPane().add(scrollPane, BorderLayout.CENTER); JPanel panel = new JPanel(); m_addButton = new JButton("Add Node"); m_addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { DefaultMutableTreeNode selNode = (DefaultMutableTreeNode) m_tree.getLastSelectedPathComponent(); if (selNode == null) { return; } DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("New"); m_model.insertNodeInto(newNode, selNode, selNode.getChildCount()); TreeNode[] nodes = m_model.getPathToRoot(newNode); TreePath path = new TreePath(nodes); m_tree.scrollPathToVisible(path); m_tree.setSelectionPath(path); m_tree.startEditingAtPath(path); } }); panel.add(m_addButton); getContentPane().add(panel, BorderLayout.SOUTH); m_delButton = new JButton("Delete Node"); m_delButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { DefaultMutableTreeNode selNode = (DefaultMutableTreeNode) m_tree.getLastSelectedPathComponent(); if (selNode == null) { return; } MutableTreeNode parent = (MutableTreeNode) (selNode.getParent()); if (parent == null) { return; } MutableTreeNode toBeSelNode = (MutableTreeNode) selNode.getPreviousSibling(); if (toBeSelNode == null) { toBeSelNode = (MutableTreeNode) selNode.getNextSibling(); } if (toBeSelNode == null) { toBeSelNode = parent; } TreeNode[] nodes = m_model.getPathToRoot(toBeSelNode); TreePath path = new TreePath(nodes); m_tree.scrollPathToVisible(path); m_tree.setSelectionPath(path); m_model.removeNodeFromParent(selNode); } }); panel.add(m_delButton); getContentPane().add(panel, BorderLayout.SOUTH); setSize(300, 400); setVisible(true); }
From source file:edu.wpi.cs.wpisuitetng.modules.requirementmanager.view.requirements.NewPieChartPanel.java
/** * @param title//from ww w . j a v a2 s .c o m * the title of the pie chart which determines if we are * displaying based on status, iteration, or users assigned to. */ public NewPieChartPanel(String title) { this.title = title; JPanel panel = new JPanel(new BorderLayout()); OverviewButtonPanel buttons = new OverviewButtonPanel(); pieChart = createPanel(); panel.add(pieChart, BorderLayout.CENTER); panel.add(buttons, BorderLayout.SOUTH); this.setViewportView(panel); }
From source file:org.jfree.graphics2d.demo.SwingUIToSVGDemo.java
private JComponent createContent() { JPanel content = new JPanel(new BorderLayout()); JTabbedPane tabs = new JTabbedPane(); tabs.add("Tab 1", new JButton("First Tab")); tabs.add("Tab 2", new JButton("Second Tab")); JButton button = new JButton("Save to SVG"); button.addActionListener(this); content.add(tabs);// ww w.java 2 s. com content.add(button, BorderLayout.SOUTH); return content; }
From source file:edu.harvard.mcz.imagecapture.UserListBrowser.java
/** * This method initializes this// w w w . ja v a2s .co m * * @return void */ private void initialize() { this.setSize(566, 308); this.setLayout(new BorderLayout()); this.add(getJPanel1(), BorderLayout.SOUTH); this.add(getJScrollPane(), BorderLayout.CENTER); this.add(getJJToolBarBar(), BorderLayout.NORTH); }
From source file:edu.wpi.cs.wpisuitetng.modules.requirementmanager.view.requirements.NewBarChartPanel.java
/** * Constructor for NewBarChartPanel.//w ww. ja va 2s . co m * * @param title String */ public NewBarChartPanel(String title) { this.title = title;//title of the chart, either status or iteration JPanel panel = new JPanel(new BorderLayout()); barChart = createPanel(); OverviewBarButton buttons = new OverviewBarButton(); panel.add(barChart, BorderLayout.CENTER); panel.add(buttons, BorderLayout.SOUTH); this.setViewportView(panel); }
From source file:fxts.stations.ui.ApplicationFrame.java
/** * Fires creation of menu, statusbar and toolbar. *//*from w w w. j a va 2s .com*/ public void create() { //creating of the toolbar mToolBar = createToolBar(); //creating of the statusbar mStatusBar = createStatusBar(); //creating of the menu mMenuBar = createMenu(); //setting of childmanager mChildManager = new ChildManager(); //adds the menu if (mMenuBar != null) { setJMenuBar(mMenuBar); } Container cp = getContentPane(); //adds the StatusBar if (mStatusBar != null) { mStatusBar.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); cp.add(BorderLayout.SOUTH, mStatusBar); } //adds ToolBar if (mToolBar != null) { mToolBar.setFloatable(true); mToolBar.setBorder(new EtchedBorder()); cp.add(BorderLayout.NORTH, mToolBar); } //adds childmanager if (mChildManager != null) { cp.add(BorderLayout.CENTER, mChildManager); } }
From source file:LDAPTest.java
public LDAPFrame() { setTitle("LDAPTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); JPanel northPanel = new JPanel(); northPanel.setLayout(new java.awt.GridLayout(1, 2, 3, 1)); northPanel.add(new JLabel("uid", SwingConstants.RIGHT)); uidField = new JTextField(); northPanel.add(uidField);// w w w . j a v a 2 s. c o m add(northPanel, BorderLayout.NORTH); JPanel buttonPanel = new JPanel(); add(buttonPanel, BorderLayout.SOUTH); findButton = new JButton("Find"); findButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { findEntry(); } }); buttonPanel.add(findButton); saveButton = new JButton("Save"); saveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { saveEntry(); } }); buttonPanel.add(saveButton); deleteButton = new JButton("Delete"); deleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { deleteEntry(); } }); buttonPanel.add(deleteButton); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { try { if (context != null) context.close(); } catch (NamingException e) { e.printStackTrace(); } } }); }