javax.swing.SpringLayout.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中javax.swing.SpringLayout.<init>()方法的一些代码示例,展示了SpringLayout.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SpringLayout.<init>()方法的具体详情如下:
包路径:javax.swing.SpringLayout
类名称:SpringLayout
方法名:<init>

SpringLayout.<init>介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

  1. SpringLayout layout = new SpringLayout();

代码示例来源:origin: stackoverflow.com

  1. String[] labels = {"Name: ", "Fax: ", "Email: ", "Address: "};
  2. int numPairs = labels.length;
  3. //Create and populate the panel.
  4. JPanel p = new JPanel(new SpringLayout());
  5. for (int i = 0; i < numPairs; i++) {
  6. JLabel l = new JLabel(labels[i], JLabel.TRAILING);
  7. p.add(l);
  8. JTextField textField = new JTextField(10);
  9. l.setLabelFor(textField);
  10. p.add(textField);
  11. }
  12. //Lay out the panel.
  13. SpringUtilities.makeCompactGrid(p,
  14. numPairs, 2, //rows, cols
  15. 6, 6, //initX, initY
  16. 6, 6); //xPad, yPad

代码示例来源:origin: opensourceBIM/BIMserver

  1. JPanel fields = new JPanel(new SpringLayout());

代码示例来源:origin: stackoverflow.com

  1. SpringLayout layout = new SpringLayout();
  2. setLayout(layout);
  3. ...
  4. add(_button);
  5. ...
  6. layout.putConstraint(SpringLayout.EAST, _button, -20, SpringLayout.EAST, this);
  7. layout.putConstraint(SpringLayout.SOUTH, _button, -20, SpringLayout.SOUTH, this);

代码示例来源:origin: stackoverflow.com

  1. JPanel status = new JPanel( new SpringLayout() ) {
  2. @Override
  3. public Dimension getMaximumSize() {
  4. Dimension max = super.getMaximumSize();
  5. Dimension min = getMinimumSize();
  6. return new Dimension( max.width, min.height );
  7. }
  8. };

代码示例来源:origin: stackoverflow.com

  1. final JPanel panel = new JPanel(new SpringLayout()) {
  2. @Override
  3. public Dimension getPreferredSize() {
  4. return new Dimension(300, 300);
  5. }
  6. };
  7. // add stuff to panel here
  8. final JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  9. add(scrollPane);

代码示例来源:origin: stackoverflow.com

  1. final JPanel panel = new JPanel(new SpringLayout());
  2. // add stuff to panel here
  3. final JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  4. scrollPane.setPreferredSize(new Dimension(300, 300));
  5. add(scrollPane);

代码示例来源:origin: stackoverflow.com

  1. JPanel contentPane = new JPanel(new SpringLayout());
  2. //...
  3. contentPane.add(makeWrapper(label));
  4. //...
  5. private static JComponent makeWrapper(JComponent c) {
  6. JPanel p = new JPanel(new BorderLayout());
  7. p.add(c, BorderLayout.NORTH);
  8. return p;
  9. }

代码示例来源:origin: de.sciss/scisslib

  1. /**
  2. * Creates a new panel with zero padding and offset
  3. */
  4. public SpringPanel()
  5. {
  6. super();
  7. layout = new SpringLayout();
  8. setLayout( layout );
  9. }

代码示例来源:origin: stackoverflow.com

  1. JPanel panel = new JPanel();
  2. SpringLayout panelLayout = new SpringLayout();
  3. panel.setLayout(panelLayout);
  4. // Adding components to the panel here
  5. // .....
  6. // That's what defines panel's exact size and makes its scrolling possible
  7. panelLayout.putConstraint(SpringLayout.SOUTH, panel, 0,
  8. SpringLayout.SOUTH, lastComponentOfThePanel);
  9. JScrollPane panelScrollPane = new JScrollPane(panel);

代码示例来源:origin: stackoverflow.com

  1. SpringLayout springLayout = new SpringLayout();
  2. Container cont = getContentPane();
  3. cont.setLayout(springLayout);
  4. JLabel label = new JLabel("New label");
  5. springLayout.putConstraint(SpringLayout.WEST, label, 20, SpringLayout.WEST, cont);
  6. springLayout.putConstraint(SpringLayout.SOUTH, label, -10, SpringLayout.SOUTH, cont);
  7. cont.add(lblNewLabel);

代码示例来源:origin: senbox-org/snap-desktop

  1. private JPanel createPreProcessingTab() {
  2. JPanel preprocessAndPatternsPanel = new JPanel(new SpringLayout());
  3. preprocessAndPatternsPanel.add(createPreProcessingPanel());
  4. SpringUtilities.makeCompactGrid(preprocessAndPatternsPanel, 1, 1,
  5. DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);
  6. preprocessAndPatternsPanel.setMaximumSize(preprocessAndPatternsPanel.getSize());
  7. return preprocessAndPatternsPanel;
  8. }

代码示例来源:origin: stackoverflow.com

  1. SpringLayout layout = new SpringLayout();
  2. JPanel contentPane = new JPanel(layout); // <-- Add the layout manager.
  3. JTextPane txtpnHello = new JTextPane();
  4. // The "Spring" for right
  5. layout.putConstraint(SpringLayout.EAST, txtpnHello, 5,
  6. SpringLayout.EAST, contentPane);
  7. // The "spring" for the bottom.
  8. layout.putConstraint(SpringLayout.SOUTH, txtpnHello, 5,
  9. SpringLayout.SOUTH, contentPane);
  10. txtpnHello.setText("Hello");
  11. txtpnHello.setEnabled(false);
  12. contentPane.add(txtpnHello);

代码示例来源:origin: com.github.danielpacak.osgi.swingconsole/osgi.swingconsole

  1. /**
  2. * Creates an empty form.
  3. */
  4. public AttributesForm() {
  5. conversionService = new AttributeValueConversionService(new DefaultConversionService());
  6. form = new JPanel(new SpringLayout());
  7. formFields = new LinkedList<AttributeFormField>();
  8. setLayout(new BorderLayout());
  9. add(form, BorderLayout.NORTH);
  10. }

代码示例来源:origin: stackoverflow.com

  1. SpringLayout layout = new SpringLayout();
  2. // For Horizontal Alignment
  3. layout.putConstraint(SpringLayout.HORIZONTAL_CENTER, component, 0, SpringLayout.HORIZONTAL_CENTER, contentPane);
  4. // For Vertical Alignment
  5. layout.putConstraint(SpringLayout.VERTICAL_CENTER, component, 0, SpringLayout.VERTICAL_CENTER, contentPane);
  6. setLayout(layout);

代码示例来源:origin: it.unibo.alchemist/alchemist-swingui

  1. /**
  2. *
  3. */
  4. public JTapeMainFeature() {
  5. super();
  6. setBackground(Color.YELLOW);
  7. springLayout = new SpringLayout();
  8. setLayout(springLayout);
  9. }

代码示例来源:origin: MrCrayfish/ModelCreator

  1. public DisplayEntryPanel(DisplayProperties.Entry entry)
  2. {
  3. this.entry = entry;
  4. this.setPreferredSize(new Dimension(200, 345));
  5. this.setLayout(new SpringLayout());
  6. this.initComponents();
  7. }

代码示例来源:origin: MrCrayfish/ModelCreator

  1. public SidebarPanel(ModelCreator creator)
  2. {
  3. this.creator = creator;
  4. this.setLayout(layout = new SpringLayout());
  5. this.setPreferredSize(new Dimension(200, 760));
  6. this.initComponents();
  7. this.setLayoutConstaints();
  8. }

代码示例来源:origin: senbox-org/snap-desktop

  1. @Override
  2. protected JPanel createPatternsPanel() {
  3. JPanel patternsPanel = new JPanel(new SpringLayout());
  4. patternsPanel.setBorder(BorderFactory.createTitledBorder(Bundle.CTL_Panel_OutputPattern_Border_TitleText()));
  5. TextFieldEditor textEditor = new TextFieldEditor();
  6. addTextField(patternsPanel, textEditor, Bundle.CTL_Label_ProgressPattern(), ToolAdapterConstants.PROGRESS_PATTERN, false, null);
  7. propertyContainer.getDescriptor(ToolAdapterConstants.PROGRESS_PATTERN).setValidator(new RegexFieldValidator());
  8. addTextField(patternsPanel, textEditor, Bundle.CTL_Label_ErrorPattern(), ToolAdapterConstants.ERROR_PATTERN, false, null);
  9. propertyContainer.getDescriptor(ToolAdapterConstants.ERROR_PATTERN).setValidator(new RegexFieldValidator());
  10. SpringUtilities.makeCompactGrid(patternsPanel, 2, 2, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);
  11. return patternsPanel;
  12. }

代码示例来源:origin: Killerardvark/CryodexSource

  1. private AboutPanel(JDialog parent) {
  2. super(new SpringLayout());
  3. this.parent = parent;
  4. String aboutText = "<HTML>This program was created for the Campaign Against Cancer Tournament. A special thanks to Chad Hoefle and Anthony Lullig for their encouragement and testing during that time. I would also like to thank all of those who encouraged me to make it better and distribute it after that tournament was complete. My goal is to have a program that #1 follows the rules and #2 is easy to use. You are welcome to contact me with any comments or concerns you have about the program. My email is Chris.Brown.SPE@gmail.com. You can also use that email to send a donation via Paypal if you feel so inclined.</HTML>";
  5. JLabel aboutLabel = new JLabel(aboutText);
  6. ComponentUtils.forceSize(aboutLabel, 400, 175);
  7. this.add(aboutLabel);
  8. this.add(ComponentUtils.addToFlowLayout(getCloseButton(),
  9. FlowLayout.CENTER));
  10. SpringUtilities.makeCompactGrid(this, this.getComponentCount(), 1, 1,
  11. 1, 1, 1);
  12. }

相关文章