本文整理汇总了Java中javax.swing.SpringLayout类的典型用法代码示例。如果您正苦于以下问题:Java SpringLayout类的具体用法?Java SpringLayout怎么用?Java SpringLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpringLayout类属于javax.swing包,在下文中一共展示了SpringLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GroupBox
import javax.swing.SpringLayout; //导入依赖的package包/类
public GroupBox(final AbstractButton b)
{
button = b;
button.addItemListener(this);
button.setOpaque(true);
button.setBackground(this.getBackground());
final int buttonHeight = button.getPreferredSize().height;
inner = new JPanel();
inner.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
BorderFactory.createEmptyBorder(buttonHeight / 2, 5, 5, 5)));
final SpringLayout layout = new SpringLayout();
super.setLayout(layout);
super.add(button);
super.add(inner);
layout.putConstraint(SpringLayout.WEST, button, 10, SpringLayout.WEST, this);
layout.putConstraint(SpringLayout.NORTH, inner, buttonHeight / 2, SpringLayout.NORTH, this);
layout.putConstraint(SpringLayout.WEST, inner, 0, SpringLayout.WEST, this);
layout.putConstraint(SpringLayout.SOUTH, this, 0, SpringLayout.SOUTH, inner);
layout.putConstraint(SpringLayout.EAST, this, 0, SpringLayout.EAST, inner);
}
示例2: PropertiesAction
import javax.swing.SpringLayout; //导入依赖的package包/类
public PropertiesAction() {
super("Properties", null);
// putValue(SHORT_DESCRIPTION, desc);
// putValue(MNEMONIC_KEY, mnemonic);
String[] labels = { "Name", "Entry time", "Exit time", "Entry cpu", "Exit cpu", "This", "Result", "Parameters"};
propsPanel = new JPanel(new SpringLayout());
for (int i = 0; i < labels.length; i++) {
JLabel l = new JLabel(labels[i] + ": ", JLabel.TRAILING);
propsPanel.add(l);
JTextField textField = new JTextField(10);
l.setLabelFor(textField);
propsPanel.add(textField);
propsMap.put(labels[i], textField);
}
SpringUtilities.makeCompactGrid(propsPanel, labels.length, 2, 5, 5, 5, 5);
}
示例3: TemplateEditor
import javax.swing.SpringLayout; //导入依赖的package包/类
public TemplateEditor(GrammarModel grammar) {
super(grammar, new SpringLayout());
setBackground(ExplorationDialog.INFO_BG_COLOR);
addName();
addExplanation();
add(Box.createRigidArea(new Dimension(0, 6)));
addKeyword();
addNrArguments();
add(Box.createRigidArea(new Dimension(0, 6)));
for (String argName : Template.this.argumentNames) {
addArgument(argName);
}
SpringUtilities.makeCompactGrid(this,
6 + Template.this.argumentNames.length,
1,
2,
2,
0,
0);
refresh();
}
示例4: prepareControls
import javax.swing.SpringLayout; //导入依赖的package包/类
protected void prepareControls() {
if(frame != null) {
frame.setVisible(false);
}
frame = new JFrame("Mixing : Dropdown Overlapping test");
frame.setLayout(new SpringLayout());
frame.setSize(200, 200);
popup = new JPopupMenu();
ActionListener menuListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
lwClicked = true;
}
};
JMenuItem item;
for (int i = 0; i < petStrings.length; i++) {
popup.add(item = new JMenuItem(petStrings[i]));
item.addActionListener(menuListener);
}
propagateAWTControls(frame);
frame.setVisible(true);
loc = frame.getContentPane().getLocationOnScreen();
}
示例5: createComponent
import javax.swing.SpringLayout; //导入依赖的package包/类
private JPanel createComponent() {
final ValueValidator validator = new ValueValidator(this.minimum, this.maximum);
final DoubleField minimumField = createDoubleField(this.minimumValueModel, this.minimumValidationModel, validator);
final DoubleField maximumField = createDoubleField(this.maximumValueModel, this.maximumValidationModel, validator);
@SuppressWarnings("serial")
final JPanel panel = new JPanel(new SpringLayout()) {
@Override
public void requestFocus() {
minimumField.getComponent().requestFocus();
}
};
panel.add(minimumField.getComponent());
panel.add(maximumField.getComponent());
SpringLayoutUtilities.makeCompactGrid(panel, 2, 1, 0, 0, 6, 0);
return panel;
}
示例6: getComponent
import javax.swing.SpringLayout; //导入依赖的package包/类
@Override
public JComponent getComponent() {
if (this.panel == null) {
final IComponentContainer container = this.container;
final JPanel component = new JPanel(new SpringLayout());
this.panel = new JPanel(new BorderLayout()) {
@Override
public void setEnabled(final boolean enabled) {
super.setEnabled(enabled);
container.setEnabled(enabled);
}
};
this.panel.add(component, BorderLayout.NORTH);
this.container.addTo(component);
SpringLayoutUtilities.makeCompactGrid(component, container.getColumnCount(), container.getRowCount(), 4, 4, 6, 6);
}
return this.panel;
}
示例7: Profile_Item_GUI
import javax.swing.SpringLayout; //导入依赖的package包/类
public Profile_Item_GUI(Profile_Item profile) throws IOException{
URL img1 = Profile_Item_GUI.this.getClass().getResource("../quadicon.png");
Image g1 = ImageIO.read(img1);
g1 = g1.getScaledInstance(80, 80, Image.SCALE_SMOOTH);
ImageIcon icon1 = new ImageIcon(g1);
l3 = new JLabel(icon1);
p2.setBorder(BorderFactory.createEtchedBorder());
p2.add(l3);
l1.setText(l1.getText()+" "+profile.getTitle());
spring.putConstraint(SpringLayout.WEST,l1,4,SpringLayout.WEST,p3);
p3.add(l1);
l2.setText(l2.getText()+" "+profile.getDescription());
spring.putConstraint(SpringLayout.NORTH,l2,16,SpringLayout.NORTH,p3);
spring.putConstraint(SpringLayout.WEST,l2,4,SpringLayout.WEST,p3);
spring.putConstraint(SpringLayout.EAST,l2,-4,SpringLayout.WEST,b);
p3.add(l2);
spring.putConstraint(SpringLayout.EAST,b,-16,SpringLayout.EAST,p3);
spring.putConstraint(SpringLayout.NORTH,b,32,SpringLayout.NORTH,p3);
p3.add(b);
p1.add(p3,BorderLayout.CENTER);
p1.add(p2,BorderLayout.WEST);
add(p1);
setLayout(new GridLayout(1,1));
this.setMinimumSize(new Dimension(1000,80));
this.setMaximumSize(new Dimension(9000,80));
}
示例8: createInputPanelArea
import javax.swing.SpringLayout; //导入依赖的package包/类
private JPanel createInputPanelArea() {
//Create and populate the panel.
JPanel springPanel = new JPanel(new SpringLayout());
springPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
JLabel lName = new JLabel("Sensor Type: ");
springPanel.add(lName);
sensorType = new JTextField();
lName.setLabelFor(sensorType);
springPanel.add(sensorType);
//Lay out the panel.
SpringUtilities.makeCompactGrid(springPanel,
1, 2, //rows, columns
6, 6, //initX, initY
6, 6); //xPad, yPad
return springPanel;
}
示例9: createInputPanelArea
import javax.swing.SpringLayout; //导入依赖的package包/类
private JPanel createInputPanelArea() {
//Create and populate the panel.
JPanel springPanel = new JPanel(new SpringLayout());
springPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
JLabel lName = new JLabel("Name: ");
springPanel.add(lName);
tfName = new JTextField();
lName.setLabelFor(tfName);
springPanel.add(tfName);
//Lay out the panel.
SpringUtilities.makeCompactGrid(springPanel,
1, 2, //rows, columns
6, 6, //initX, initY
6, 6); //xPad, yPad
return springPanel;
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:20,代码来源:AddApplicationModule.java
示例10: createInputPanelArea
import javax.swing.SpringLayout; //导入依赖的package包/类
private JPanel createInputPanelArea() {
//Create and populate the panel.
JPanel springPanel = new JPanel(new SpringLayout());
springPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
JLabel lName = new JLabel("Name: ");
springPanel.add(lName);
actuatorName = new JTextField();
lName.setLabelFor(actuatorName);
springPanel.add(actuatorName);
JLabel lType = new JLabel("Actuator Type : ");
springPanel.add(lType);
actuatorType = new JTextField();
lName.setLabelFor(actuatorType);
springPanel.add(actuatorType);
//Lay out the panel.
SpringUtilities.makeCompactGrid(springPanel,
2, 2, //rows, columns
6, 6, //initX, initY
6, 6); //xPad, yPad
return springPanel;
}
示例11: createInputPanelArea
import javax.swing.SpringLayout; //导入依赖的package包/类
private JPanel createInputPanelArea() {
//Create and populate the panel.
JPanel springPanel = new JPanel(new SpringLayout());
springPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
JLabel lName = new JLabel("Sensor Type: ");
springPanel.add(lName);
actuatorType = new JTextField();
lName.setLabelFor(actuatorType);
springPanel.add(actuatorType);
//Lay out the panel.
SpringUtilities.makeCompactGrid(springPanel,
1, 2, //rows, columns
6, 6, //initX, initY
6, 6); //xPad, yPad
return springPanel;
}
示例12: KautotuSartzekoPanela
import javax.swing.SpringLayout; //导入依赖的package包/类
public KautotuSartzekoPanela() {
this.setLayout(new SpringLayout());
this.erabiltzailea = new JLabel("Erabiltzaile izena:", SwingConstants.TRAILING);
this.erabiltzaileaField = new JTextField();
this.erabiltzaileaField.setName("Erabiltzailea Field");
this.erabiltzaileaField.addActionListener(gureAE -> AlKaboom.getAlKaboom().getUI().getKautotu()
.getKautotuPanela().taulaEguneratu(this.erabiltzaileaField.getText()));
this.erabiltzaileaField.addKeyListener(this);
this.erabiltzailea.setLabelFor(erabiltzaileaField);
this.zailtasuna = new JLabel("Zailtasuna:", SwingConstants.TRAILING);
aukerakArray = new String[] { "Erreza", "Normala", "Zaila", "Custom..." };
this.aukerakEraiki(0);
this.zailtasuna.setLabelFor(aukerak);
this.sartu = new JButton("Sartu");
this.sartu.setName("Sartu");
this.sartu.setEnabled(false);
this.sartu.addActionListener(gureAE -> this.datuakGorde());
this.aukerazkoa = new JButton("Zailtasuna Aukeratu...");
this.aukerazkoa.setEnabled(false);
this.aukerazkoa.setName("Zailtasuna Sartu");
this.aukerazkoa.addActionListener(gureAE -> AlKaboom.getAlKaboom().getUI().getKautotu().zailtasunaIpini());
this.guztiaGehitu();
}
示例13: EmployeeFrame
import javax.swing.SpringLayout; //导入依赖的package包/类
public EmployeeFrame(String title) {
super(title);
contentPanel.setLayout(new GridLayout(0, 3, 0, 0));
JPanel panel = new JPanel();
contentPanel.add(panel);
JPanel pan = new JPanel();
contentPanel.add(pan);
SpringLayout slPanel = new SpringLayout();
pan.setLayout(slPanel);
caretakerButton = new JButton("Caretaker");
slPanel.putConstraint(SpringLayout.NORTH, caretakerButton, 65, SpringLayout.NORTH, pan);
slPanel.putConstraint(SpringLayout.WEST, caretakerButton, 93, SpringLayout.WEST, pan);
pan.add(caretakerButton);
JPanel rightPanel = new JPanel();
contentPanel.add(rightPanel);
setVisible(true);
}
示例14: createCellSpecificComponents
import javax.swing.SpringLayout; //导入依赖的package包/类
@Override
protected void createCellSpecificComponents() {
try {
Dimension dim2 = new Dimension(35, 35);
JToggleButton tglInfinite = gettglInfinite(dim2);
JToggleButton tglBound = getBoundButon(dim2);
JPanel pnlBoundOrInfinite = new JPanel(new SpringLayout());
pnlBoundOrInfinite.add(tglInfinite);
pnlBoundOrInfinite.add(tglBound);
if (getPlace().isBounded()) {
tglBound.setEnabled(false);
tglInfinite.setEnabled(true);
}
if (!getPlace().isBounded()) {
tglBound.setEnabled(true);
tglInfinite.setEnabled(false);
}
SpringUtilities.makeCompactGrid(pnlBoundOrInfinite, 1, 2, 1, 1, 1, 1);
mainPanel().add(pnlBoundOrInfinite);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Buttons could not be added. \nReason: " + e.getMessage(), "" + e.getClass(), JOptionPane.ERROR);
}
}
示例15: addToNorth
import javax.swing.SpringLayout; //导入依赖的package包/类
@Override
protected JPanel addToNorth() {
JPanel p = new JPanel();
nameField = new JTextField();
p.setLayout(new SpringLayout());
p.add(prepareFieldLabel("New data object name"));
p.add(nameField);
// lay out the panel
SpringUtilities.makeCompactGrid(p,
(p.getComponentCount() / 2), 2, // rows, cols
0, 0, // initX, initY
5, 10); //xPad, yPad
return p;
}