congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
JPanel.setLayout
Code IndexAdd Tabnine to your IDE (free)

How to use
setLayout
method
in
javax.swing.JPanel

Best Java code snippets using javax.swing.JPanel.setLayout (Showing top 20 results out of 10,089)

Refine searchRefine arrow

  • JPanel.add
  • JPanel.<init>
  • 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: 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: stackoverflow.com

 JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
origin: stackoverflow.com

 JPanel jPanel1 = new JPanel();
jPanel1.setLayout(new java.awt.BorderLayout());
 ..
ChartPanel CP = new ChartPanel(chart);
.. 
jPanel1.add(CP,BorderLayout.CENTER);
jPanel1.validate();
origin: MovingBlocks/Terasology

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);
}
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 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);
}
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: opentripplanner/OpenTripPlanner

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;
}

origin: zzz40500/GsonFormat

rendererComponent.setLayout(new BorderLayout());
rendererComponent.add(_checkBox);
rendererComponent.add(_label, BorderLayout.LINE_END);
origin: log4j/log4j

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

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);
}
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(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: wiztools/rest-client

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;
}

origin: opentripplanner/OpenTripPlanner

protected JComponent makeTextPanel(String text) {
  JPanel panel = new JPanel(false);
  JLabel filler = new JLabel(text);
  filler.setHorizontalAlignment(JLabel.CENTER);
  panel.setLayout(new GridLayout(1, 1));
  panel.add(filler);
  return panel;
}
origin: stackoverflow.com

 JPanel container = new JPanel();
container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));

JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();

//panel1.set[Preferred/Maximum/Minimum]Size()

container.add(panel1);
container.add(panel2);
origin: stanfordnlp/CoreNLP

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;
}
origin: ballerina-platform/ballerina-lang

public ServersGUI() {
  rootPanel = new JPanel();
  rootPanel.setLayout(new BoxLayout(rootPanel, BoxLayout.Y_AXIS));
  rootPanel.add(createArtifactRow("", "", "", ""));
}
origin: stackoverflow.com

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

/**
 * 将各个界面添加到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);
}
javax.swingJPanelsetLayout

Popular methods of JPanel

  • <init>
  • add
  • 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
  • setScale (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • putExtra (Intent)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Permission (java.security)
    Legacy security code; do not use.
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top 12 Jupyter Notebook extensions
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