protected JPanel createStatusArea() { JPanel statusArea = new JPanel(); JLabel status = new JLabel("No log records to display."); _statusLabel = status; status.setHorizontalAlignment(JLabel.LEFT); statusArea.setBorder(BorderFactory.createEtchedBorder()); statusArea.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); statusArea.add(status); return (statusArea); }
JPanel jPanel1 = new JPanel(); jPanel1.setLayout(new java.awt.BorderLayout()); .. ChartPanel CP = new ChartPanel(chart); .. jPanel1.add(CP,BorderLayout.CENTER); jPanel1.validate();
MyRenderer() { setBackground(BACKGROUND); setLayout(new BorderLayout()); pHead.setLayout(new BorderLayout()); pHead.setBackground(BACKGROUND); pHead.add(pList, BorderLayout.LINE_START); pHead.add(lActive, BorderLayout.LINE_END); pHead.add(pError, BorderLayout.PAGE_END); lId.setHorizontalAlignment(SwingConstants.RIGHT); lName.setForeground(Color.BLUE); lCounters.setForeground(Color.GRAY); pList.setLayout(new FlowLayout(FlowLayout.LEFT, 4, 2)); pList.setBackground(BACKGROUND); pList.add(lId); pList.add(lName); pList.add(lCounters); pError.setVisible(false); pError.setLayout(new FlowLayout(FlowLayout.LEFT, 4, 2)); pError.setBackground(BACKGROUND); pError.add(lErrorSpacer); pError.add(lError); lError.setForeground(Color.RED); add(pHead, BorderLayout.PAGE_START); }
private void uiLayout () { title.setLayout(new GridLayout(1, 2)); minimize.setPreferredSize(new Dimension(50, 26)); exit.setPreferredSize(new Dimension(50, 26)); title.add(minimize); title.add(exit); topBar.setLayout(new GridLayout(1, 1)); topBar.add(windowLabel, new GridBagConstraints(0, 0, 0, 0, 0, 0, NORTHWEST, VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); setLayout(new GridBagLayout()); add(topBar, new GridBagConstraints(0, 0, 0, 0, 0, 0, NORTH, HORIZONTAL, new Insets(0, 0, 0, 100), 0, 10)); add(title, new GridBagConstraints(0, 0, 0, 0, 0, 0, NORTHEAST, NONE, new Insets(0, 0, 0, 0), 0, 0)); add(logo, new GridBagConstraints(0, 0, 1, 1, 1, 0, CENTER, HORIZONTAL, new Insets(40, 6, 6, 6), 0, 0)); add(form, new GridBagConstraints(0, 1, 1, 1, 1, 0, CENTER, HORIZONTAL, new Insets(6, 6, 0, 6), 0, 0)); add(buttonPanel, new GridBagConstraints(0, 2, 1, 1, 0, 0, CENTER, NONE, new Insets(0, 0, 0, 0), 0, 0)); add(scrollPane, new GridBagConstraints(0, 3, 1, 1, 1, 1, CENTER, BOTH, new Insets(6, 6, 6, 6), 0, 0)); }
private void setup() { setLayout(new BorderLayout()); JPanel bot = new JPanel(); add(jt.getTableHeader(), BorderLayout.NORTH); bot.setLayout(new BorderLayout()); bot.add(del, BorderLayout.EAST); add(bot, BorderLayout.SOUTH); JScrollPane jsp = new JScrollPane(jt); jsp.setPreferredSize(new Dimension(500, 250)); add(jsp, BorderLayout.CENTER); del.addActionListener(new DListener()); JRootPane rootPane = SwingUtilities.getRootPane(del); rootPane.setDefaultButton(del); setVisible(true); }
private Container makeMainTab() { Container pane = new JPanel(); pane.setLayout(new BorderLayout()); // init center graphical panel showGraph = new ShowGraph(this, getGraph()); pane.add(showGraph, BorderLayout.CENTER); traverseVisitor = new VisualTraverseVisitor(showGraph); // init left panel leftPanel = new JPanel(); leftPanel.setLayout(new BorderLayout()); pane.add(leftPanel, BorderLayout.LINE_START); initRoutingSubpanel(); initVertexInfoSubpanel(); initControlButtons(); // init right panel initRightPanel(pane); return pane; }
rendererComponent.setLayout(new BorderLayout()); rendererComponent.add(_checkBox); rendererComponent.add(_label, BorderLayout.LINE_END);
public LogFactor5LoadingDialog(JFrame jframe, String message) { super(jframe, "LogFactor5", false); JPanel bottom = new JPanel(); bottom.setLayout(new FlowLayout()); JPanel main = new JPanel(); main.setLayout(new GridBagLayout()); wrapStringOnPanel(message, main); getContentPane().add(main, BorderLayout.CENTER); getContentPane().add(bottom, BorderLayout.SOUTH); show(); } //--------------------------------------------------------------------------
public CategoryNodeRenderer() { _panel.setBackground(UIManager.getColor("Tree.textBackground")); if (_sat == null) { // Load the satellite image. String resource = "/org/apache/log4j/lf5/viewer/images/channelexplorer_satellite.gif"; URL satURL = getClass().getResource(resource); _sat = new ImageIcon(satURL); } setOpaque(false); _checkBox.setOpaque(false); _panel.setOpaque(false); // The flowlayout set to LEFT is very important so that the editor // doesn't jump around. _panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); _panel.add(_checkBox); _panel.add(this); setOpenIcon(_sat); setClosedIcon(_sat); setLeafIcon(_sat); }
private void setup() { setLayout(new BorderLayout()); JPanel panel = new JPanel(); add(jl, BorderLayout.SOUTH); add(panel, BorderLayout.CENTER); panel.setLayout(new GridLayout(6, 2)); panel.add(new JLabel("Name")); panel.add(jtFields[0]); panel.add(new JLabel("Contact Number")); panel.add(jtFields[1]); panel.add(new JLabel("Address")); panel.add(jtAreas[0]); panel.add(new JLabel("Deposit Number")); panel.add(processButton); clearButton.addActionListener(e -> { for (JTextArea i : jtAreas) { i.setText(""); processButton.addActionListener(e -> { Order order = new Order(jtFields[0].getText(), jtFields[1].getText(), jtAreas[0].getText(), jtFields[2].getText(), jtAreas[1].getText());
public static JPanel getFlowLayoutPanelLeftAligned(String title, Component component){ JPanel jp = new JPanel(); jp.setLayout(new FlowLayout(FlowLayout.LEFT)); if(title != null){ if(component instanceof JPanel){ JPanel p = (JPanel)component; p.setBorder(BorderFactory.createTitledBorder(title)); } } jp.add(component); return jp; }
private JPanel makeFoundStatsBox() { JPanel foundStatsBox = new JPanel(); foundStatsBox.setLayout(new GridBagLayout()); Box labelBox = Box.createHorizontalBox(); foundStats = new JLabel(" "); labelBox.add(foundStats); historyButton = new JButton("Statistics"); historyButton.setEnabled(false); historyButton.addActionListener(this); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1.7; foundStatsBox.add(labelBox,c); c.weightx = .3; c.gridwidth = 1; foundStatsBox.add(historyButton); return foundStatsBox; }
JFrame frame = new JFrame(); frame.setLayout(new BorderLayout()); frame.setSize(200, 200); // create the status bar panel and shove it down the bottom of the frame JPanel statusPanel = new JPanel(); statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); frame.add(statusPanel, BorderLayout.SOUTH); statusPanel.setPreferredSize(new Dimension(frame.getWidth(), 16)); statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS)); JLabel statusLabel = new JLabel("status"); statusLabel.setHorizontalAlignment(SwingConstants.LEFT); statusPanel.add(statusLabel); frame.setVisible(true);
/** * 将各个界面添加到JFrame中 * * @param pane JFrame内部的Container对象 */ private void addComponentsToPane(Container pane) { JScrollPane scrollPane = new JScrollPane(); JPanel contentPanel = new JPanel(); contentPanel.setLayout(new GridLayout(0, 1)); final JTextArea sqlField = new JTextArea(formatSql, 8, 20); final JScrollPane content1 = new JScrollPane(sqlField); content1.setBorder((TitledBorder) BorderFactory.createTitledBorder("SQL语句")); contentPanel.add(content1); addTable(contentPanel, "解析信息", parseData); addTable(contentPanel, "上次慢查询信息", lastSlowData); addTable(contentPanel, "上次错误查询信息", lastErrorData); addTable(contentPanel, "其他信息", otherData); scrollPane.setViewportView(contentPanel); pane.add(scrollPane, BorderLayout.CENTER); }