public void run () { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setSize(480, 320); frame.setLocationRelativeTo(null); JPanel panel = new JPanel(); frame.getContentPane().add(panel); panel.add(new NewSlider(200, 100, 500, 0.1f, 150, 300)); frame.setVisible(true); } });
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);
/** * Remove all trees from the display */ public void clearMatches() { JPanel spaceholder = new JPanel(); spaceholder.setBackground(Color.white); scroller.setViewportView(spaceholder); scroller.validate(); scroller.repaint(); matchedPartCoordinates = null; matchedPartCoordinateIdx = -1; }
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); }
private void buildImagePanel (JLabel previewImage, File file) { previewContainer.removeAll(); previewContainer.add(previewImage, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); previewContainer.updateUI(); PreviewImagePanel.this.editor.renderer.setImageBackground(file); } });
public void afterPropertiesSet() throws Exception { ClassPathResource resource = new ClassPathResource("logo.png"); ImageIcon icon = new ImageIcon(resource.getURL()); JLabel logo = new JLabel(icon); saveButton = new JButton("Save Value"); saveButton.addActionListener(this); refreshButton = new JButton("Refresh Value"); refreshButton.addActionListener(this); JPanel valuePanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); valuePanel.add(valueField); valuePanel.add(saveButton); valuePanel.add(refreshButton); secureMethod1Button = new JButton("Method #1"); secureMethod3Button.addActionListener(this); JPanel methodPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); methodPanel.add(secureMethod1Button); methodPanel.add(secureMethod2Button); methodPanel.add(secureMethod3Button); frame = new JFrame("Apache Shiro Sample Application"); frame.setSize(500, 200);
public void go() throws Exception { if(!no_channel && !use_state) channel.connect(cluster_name); mainFrame=new JFrame(); mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); panel=new DrawPanel(use_state); panel.setBackground(background_color); sub_panel=new JPanel(); mainFrame.getContentPane().add("Center", panel); clear_button=new JButton("Clear"); clear_button.setFont(default_font); clear_button.addActionListener(this); leave_button=new JButton("Leave"); leave_button.setFont(default_font); leave_button.addActionListener(this); sub_panel.add("South", clear_button); sub_panel.add("South", leave_button); mainFrame.getContentPane().add("South", sub_panel); mainFrame.setBackground(background_color); clear_button.setForeground(Color.blue); leave_button.setForeground(Color.blue); mainFrame.pack(); mainFrame.setLocation(15, 25); mainFrame.setBounds(new Rectangle(250, 250)); if(!no_channel && use_state) { channel.connect(cluster_name, null, state_timeout); } mainFrame.setVisible(true); setTitle(); }
JPanel descriptionPanel = new JPanel(); descriptionPanel.setLayout(new GridBagLayout()); getContentPane().add( descriptionPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); descriptionPanel.setBackground(Color.white); descriptionPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black)); descriptionPanel.add(descriptionText, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); descriptionText.setWrapStyleWord(true); JPanel panel = new JPanel(); getContentPane().add( panel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); panel.add(new JLabel(name + ":")); panel.add(component); JPanel buttonPanel = new JPanel(); getContentPane().add( buttonPanel, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); JButton okButton = new JButton("OK"); buttonPanel.add(okButton);
public static void main(String args[]){ JFrame f = new JFrame(); f.setLayout(new BorderLayout()); final JPanel p = new JPanel(); p.add(new JLabel("A Panel")); f.add(p, BorderLayout.CENTER); //create a button which will hide the panel when clicked. JButton b = new JButton("HIDE"); b.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ p.setVisible(false); } }); f.add(b,BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
public LogFactor5ErrorDialog(JFrame jframe, String message) { super(jframe, "Error", true); JButton ok = new JButton("Ok"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { hide(); } }); JPanel bottom = new JPanel(); bottom.setLayout(new FlowLayout()); bottom.add(ok); JPanel main = new JPanel(); main.setLayout(new GridBagLayout()); wrapStringOnPanel(message, main); getContentPane().add(main, BorderLayout.CENTER); getContentPane().add(bottom, BorderLayout.SOUTH); show(); } //--------------------------------------------------------------------------
public final void initUI() { Font font = new Font("Serif", Font.BOLD, 13); JLabel name = new JLabel("jadx"); name.setFont(font); name.setAlignmentX(0.5f); JLabel desc = new JLabel("Dex to Java decompiler"); version.setAlignmentX(0.5f); JPanel textPane = new JPanel(); textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); textPane.setLayout(new BoxLayout(textPane, BoxLayout.PAGE_AXIS)); textPane.add(Box.createRigidArea(new Dimension(0, 10))); textPane.add(name); textPane.add(Box.createRigidArea(new Dimension(0, 10))); textPane.add(desc); textPane.add(Box.createRigidArea(new Dimension(0, 10))); textPane.add(version); textPane.add(Box.createRigidArea(new Dimension(0, 20))); JButton close = new JButton(NLS.str("tabs.close")); close.addActionListener(event -> dispose()); close.setAlignmentX(0.5f); contentPane.add(textPane, BorderLayout.CENTER); contentPane.add(close, BorderLayout.PAGE_END);
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(jtFields[2]); panel.add(new JLabel("Order")); panel.add(jtAreas[1]); panel.add(clearButton); 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());
private void addTable(ColumnData columnData) { ArrayList<ArrayList<LinkedHashMap<String, Object>>> data = columnData.getTableData(); int i = 0; ArrayList<String> ids = columnData.getNames(); for (ArrayList<LinkedHashMap<String, Object>> listNow : data) { JTable table = new JTable(); tableModel = new DruidTableModel(listNow); table.setModel(tableModel); String id = ids.get(i); JPanel panelNow = new JPanel(new BorderLayout()); panelNow.setBorder((TitledBorder) BorderFactory.createTitledBorder(KEY_WORD_IDENTITY + ":" + id)); contentPanel.add(panelNow); panelNow.add(table.getTableHeader(), BorderLayout.NORTH); panelNow.add(table); table.getColumnModel().getColumn(0).setCellRenderer(new DruidTableCellRenderer()); i++; } }
private void init() { JTextArea errorArea = new JTextArea(); errorArea.setEditable(false); errorArea.setText(exc.getMessage() + "\n"); getContentPane().setLayout(new BorderLayout()); JPanel messagePanel = new JPanel(new BorderLayout()); messagePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory .createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("COMPILE_ERROR.PANEL.TITLE")))); messagePanel.add(new JScrollPane(errorArea), BorderLayout.CENTER); getContentPane().add(messagePanel, BorderLayout.CENTER); JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.RIGHT)); okBtn = new JButton(NLS.nls("COMPILE_ERROR.OK_BUTTON.CAPTION")); okBtn.addActionListener(this); btnPane.add(okBtn); getRootPane().setDefaultButton(okBtn); getContentPane().add(btnPane, BorderLayout.SOUTH); pack(); setLocationRelativeTo(getParent()); setVisible(true); }
textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); JPanel controlPane = new JPanel(); controlPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); final JComboBox<Level> cb = new JComboBox<>(LEVEL_ITEMS); cb.setSelectedItem(level); registerLogListener(); }); JLabel levelLabel = new JLabel(NLS.str("log_viewer.log_level")); levelLabel.setLabelFor(cb); controlPane.add(levelLabel); controlPane.add(cb); JButton close = new JButton(NLS.str("tabs.close")); close.addActionListener(event -> close()); close.setAlignmentX(0.5f); contentPane.add(controlPane, BorderLayout.PAGE_START); contentPane.add(scrollPane, BorderLayout.CENTER); contentPane.add(close, BorderLayout.PAGE_END);
final JPanel gui = new JPanel(new BorderLayout(5,5)); gui.setBorder( new TitledBorder("BorderLayout(5,5)") ); JPanel plafComponents = new JPanel( new FlowLayout(FlowLayout.RIGHT, 3,3)); plafComponents.setBorder( new TitledBorder("FlowLayout(FlowLayout.RIGHT, 3,3)") ); plafComponents.add(plafChooser); plafComponents.add(pack); gui.add(plafComponents, BorderLayout.NORTH); JPanel dynamicLabels = new JPanel(new BorderLayout(4,4)); dynamicLabels.setBorder( final JPanel labels = new JPanel(new GridLayout(0,2,3,3)); JButton addNew = new JButton("Add Another Label"); labels.add( new JLabel("Label " + ++labelCount) ); new Dimension(tablePreferred.width, tablePreferred.height/3) ); JPanel imagePanel = new JPanel(new GridBagLayout()); frame.setContentPane(gui);
JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new MainPanel()); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); private JButton reset = new JButton("Reset"); private Model model; private ColorIcon icon = new ColorIcon(80, Color.gray); private JLabel label = new JLabel(s, icon, JLabel.CENTER); super(new BorderLayout()); this.model = model; label.setVerticalTextPosition(JLabel.BOTTOM); label.setHorizontalTextPosition(JLabel.CENTER); this.add(label, BorderLayout.CENTER); JPanel panel = new JPanel(); for (Piece p : Piece.values()) { PieceButton pb = new PieceButton(p);
public static void main(String[] args) { JFrame frame = new TestScrollPane(); JPanel panel = new JPanel(); JTable table = new JTable(); panel.setLayout(new BorderLayout()); panel.add(new JLabel("NORTH"), BorderLayout.NORTH); panel.add(new JLabel("SOUTH"), BorderLayout.SOUTH); JScrollPane sp = new JScrollPane(table); sp.setBorder(BorderFactory.createEmptyBorder()); panel.add(sp, BorderLayout.CENTER); frame.add(panel); frame.setVisible(true); }
private void initUI() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.add(makeDeobfuscationGroup()); panel.add(makeDecompilationGroup()); panel.add(makeEditorGroup()); panel.add(makeOtherGroup()); JButton saveBtn = new JButton(NLS.str("preferences.save")); saveBtn.addActionListener(event -> { settings.sync(); if (needReload) { JButton cancelButton = new JButton(NLS.str("preferences.cancel")); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); buttonPane.add(resetBtn); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(saveBtn); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); buttonPane.add(cancelButton); contentPane.add(panel, BorderLayout.CENTER); contentPane.add(buttonPane, BorderLayout.PAGE_END); getRootPane().setDefaultButton(saveBtn);