Tabnine Logo
JPanel.add
Code IndexAdd Tabnine to your IDE (free)

How to use
add
method
in
javax.swing.JPanel

Best Java code snippets using javax.swing.JPanel.add (Showing top 20 results out of 13,320)

Refine searchRefine arrow

  • JPanel.<init>
  • JPanel.setLayout
  • JLabel.<init>
  • BorderLayout.<init>
  • JButton.<init>
  • JButton.addActionListener
origin: log4j/log4j

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);
}
origin: libgdx/libgdx

  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);
  }
});
origin: go-lang-plugin-org/go-lang-idea-plugin

@Nullable
@Override
protected JComponent createCenterPanel() {
 JPanel panel = new JPanel(new BorderLayout());
 panel.add(myCommandTextField, BorderLayout.NORTH);
 return panel;
}
origin: apache/ignite

/**
 * @param components Components.
 * @return Panel.
 */
private JPanel createPanel(JComponent... components) {
  JPanel panel = new JPanel();
  panel.setLayout(new FlowLayout());
  for (JComponent component : components)
    panel.add(component);
  return panel;
}
origin: libgdx/libgdx

JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0, 
  GridBagConstraints.WEST, GridBagConstraints.NONE,
  new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0, 
  GridBagConstraints.WEST, GridBagConstraints.NONE,
  new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add( magnitudePanel = new ScaledNumericPanel(editor, null, charTitle, "Strength", "In world units per second.", true), 
  new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
    new Insets(0, 0, 0, 6), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  new Insets(0, 0, 0, 0), 0, 0));
origin: libgdx/libgdx

  private void initializeComponents () {
    JPanel contentPanel = getContentPanel();
    {
      JLabel label = new JLabel("Value:");
      contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 6), 0, 0));
    }
    {
      valueSpinner = new JSpinner(new SpinnerNumberModel(new Float(0), new Float(-99999), new Float(99999), new Float(0.1f)));
      contentPanel.add(valueSpinner, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.WEST,
        GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    }
  }
}
origin: ballerina-platform/ballerina-lang

private JButton createNewRowButton() {
  final JButton newRowButton = new JButton();
  newRowButton.setText("+");
  newRowButton.addActionListener(e -> rootPanel.add(createArtifactRow("", "", "", "")));
  return newRowButton;
}
origin: kiegroup/optaplanner

private JComponent createTopButtonPanel() {
  JPanel buttonPanel = new JPanel(new GridLayout(1, 6));
  buttonPanel.add(new JButton(new ExpandNodesAction()));
  buttonPanel.add(new JButton(new CollapseNodesAction()));
  buttonPanel.add(new JButton(new MoveNodeAction(true)));
  buttonPanel.add(new JButton(new MoveNodeAction(false)));
  renameNodeButton = new JButton(new RenameNodeAction());
  renameNodeButton.setEnabled(false);
  buttonPanel.add(renameNodeButton);
  buttonPanel.add(new JButton(new SwitchLevelsAction(false)));
  return buttonPanel;
}
origin: libgdx/libgdx

  private void initializeComponents () {
    JPanel contentPanel = getContentPanel();
    {
      label = new JLabel("Value:");
      contentPanel.add(label, new GridBagConstraints(2, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 6), 0, 0));
    }
    {
      minSlider = new Slider(0, -99999, 99999, 1, -400, 400);
      contentPanel.add(minSlider, new GridBagConstraints(3, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 0), 0, 0));
    }
    {
      maxSlider = new Slider(0, -99999, 99999, 1, -400, 400);
      contentPanel.add(maxSlider, new GridBagConstraints(4, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
        new Insets(0, 6, 0, 0), 0, 0));
    }
    {
      rangeButton = new JButton("<");
      rangeButton.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
      contentPanel.add(rangeButton, new GridBagConstraints(5, 2, 1, 1, 1.0, 0, GridBagConstraints.WEST,
        GridBagConstraints.NONE, new Insets(0, 1, 0, 0), 0, 0));
    }
  }
}
origin: libgdx/libgdx

  private void initializeComponents (String chartTitle) {
    JPanel contentPanel = getContentPanel();
    {
      chart = new Chart(chartTitle) {
        public void pointsChanged () {
          value.setTimeline(chart.getValuesX());
          value.setScaling(chart.getValuesY());
        }
      };
      chart.setPreferredSize(new Dimension(150, 62));
      contentPanel.add(chart, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
        new Insets(0, 0, 0, 0), 0, 0));
    }
    {
      expandButton = new JButton("+");
      expandButton.setBorder(BorderFactory.createEmptyBorder(4, 10, 4, 10));
      contentPanel.add(expandButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST,
        GridBagConstraints.NONE, new Insets(0, 6, 0, 0), 0, 0));
    }
  }
}
origin: libgdx/libgdx

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));
}
origin: iluwatar/java-design-patterns

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());
origin: alibaba/druid

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++;
  }
}
origin: wiztools/rest-client

public static JPanel getFlowLayoutLeftAlignedMulti(Component ... components) {
  JPanel jp = new JPanel();
  jp.setLayout(new FlowLayout(FlowLayout.LEFT));
  
  for(Component c: components) {
    jp.add(c);
  }
  
  return jp;
}

origin: libgdx/libgdx

JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0, 
  GridBagConstraints.WEST, GridBagConstraints.NONE,
  new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0, 
  GridBagConstraints.WEST, GridBagConstraints.NONE,
  new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add( magnitudePanel = new ScaledNumericPanel(editor, null, charTitle, "Strength", "In world units per second.", true), 
  new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
    new Insets(0, 0, 0, 6), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  new Insets(0, 0, 0, 0), 0, 0));
origin: libgdx/libgdx

  private void initializeComponents () {
    JPanel contentPanel = getContentPanel();
    {
      JLabel label = new JLabel("Value:");
      contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 6), 0, 0));
    }
    {
      valueSpinner = new JSpinner(new SpinnerNumberModel(new Float(0), new Float(-99999), new Float(99999), new Float(0.1f)));
      contentPanel.add(valueSpinner, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.WEST,
        GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    }
  }
}
origin: libgdx/libgdx

  contentPanel.add(chart, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));
  expandButton = new JButton("+");
  expandButton.setBorder(BorderFactory.createEmptyBorder(4, 10, 4, 10));
  contentPanel.add(expandButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST,
    GridBagConstraints.NONE, new Insets(0, 6, 0, 0), 0, 0));
expandButton.addActionListener(new ActionListener() {
  public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
origin: groovy/groovy-core

public void testComponentParent() {
  if (HeadlessTestSupport.isHeadless()) return;
  JPanel panel = new JPanel();
  JButton bean = new JButton();
  panel.add(bean);
  Object value = InvokerHelper.getProperty(bean, "parent");
  assertTrue(value != null);
}
origin: libgdx/libgdx

  private void initializeComponents () {
    JPanel contentPanel = getContentPanel();
    {
      label = new JLabel("Value:");
      contentPanel.add(label, new GridBagConstraints(2, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 6), 0, 0));
    }
    {
      minSlider = new Slider(0, -99999, 99999, 1, -400, 400);
      contentPanel.add(minSlider, new GridBagConstraints(3, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 0), 0, 0));
    }
    {
      maxSlider = new Slider(0, -99999, 99999, 1, -400, 400);
      contentPanel.add(maxSlider, new GridBagConstraints(4, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
        new Insets(0, 6, 0, 0), 0, 0));
    }
    {
      rangeButton = new JButton("<");
      rangeButton.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
      contentPanel.add(rangeButton, new GridBagConstraints(5, 2, 1, 1, 1.0, 0, GridBagConstraints.WEST,
        GridBagConstraints.NONE, new Insets(0, 1, 0, 0), 0, 0));
    }
  }
}
origin: libgdx/libgdx

  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);
  }
});
javax.swingJPaneladd

Popular methods of JPanel

  • <init>
  • setLayout
  • setBorder
  • setBackground
  • setPreferredSize
  • removeAll
  • setOpaque
  • paintComponent
  • setVisible
  • remove
  • repaint
  • setMinimumSize
  • repaint,
  • setMinimumSize,
  • getPreferredSize,
  • revalidate,
  • setEnabled,
  • getLayout,
  • paint,
  • validate,
  • getComponents

Popular in Java

  • Running tasks concurrently on multiple threads
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • JPanel (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now