javax.swing.SpringLayout源码实例Demo

类javax.swing.SpringLayout源码实例Demo

下面列出了怎么用javax.swing.SpringLayout的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: PacketProxy   文件: GUIServerNamePanel.java
public GUIServerNamePanel() {
	setPreferredSize(new Dimension(100, 24));
	setMinimumSize(new Dimension(10, 24));
	setMaximumSize(new Dimension(1000, 24));
	SpringLayout layout = new SpringLayout();
	setLayout(layout);

	client_label = new JLabel(" ");
	client_label.setHorizontalAlignment(JLabel.LEFT);
	client_label.setVerticalAlignment(JLabel.TOP);
	layout.putConstraint(SpringLayout.WEST, client_label, 10, SpringLayout.WEST, this);
	layout.putConstraint(SpringLayout.NORTH, client_label, 4, SpringLayout.NORTH, this);
	add(client_label);

	server_label = new JLabel(" ");
	server_label.setHorizontalAlignment(JLabel.LEFT);
	server_label.setVerticalAlignment(JLabel.TOP);
	layout.putConstraint(SpringLayout.WEST, server_label, 0, SpringLayout.EAST, client_label);
	layout.putConstraint(SpringLayout.NORTH, server_label, 4, SpringLayout.NORTH, this);
	add(server_label);
}
 
源代码2 项目: JavaMainRepo   文件: MainMenuFrame.java
public MainMenuFrame(String title) {
	super(title);
	contentPanel.setLayout(new GridLayout(0, 3, 0, 0));
	JPanel panel = new JPanel();
	// adding empty panel to fill grid layout
	contentPanel.add(panel);
	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);
	btnAdd = new JButton("Add");
	slPanel.putConstraint(SpringLayout.NORTH, btnAdd, 65, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnAdd, 93, SpringLayout.WEST, pan);
	pan.add(btnAdd);
	btnList = new JButton("List");
	slPanel.putConstraint(SpringLayout.NORTH, btnList, 150, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnList, 94, SpringLayout.WEST, pan);
	pan.add(btnList);
	btnSaveAndExit = new JButton("Save and Exit");
	slPanel.putConstraint(SpringLayout.NORTH, btnSaveAndExit, 264, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnSaveAndExit, 69, SpringLayout.WEST, pan);
	pan.add(btnSaveAndExit);
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码3 项目: JavaMainRepo   文件: EmployeeFrame.java
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);
}
 
源代码4 项目: JavaMainRepo   文件: AddFrame.java
public AddFrame(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);

	animalButton = new JButton("Animal");
	slPanel.putConstraint(SpringLayout.NORTH, animalButton, 65, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, animalButton, 93, SpringLayout.WEST, pan);
	pan.add(animalButton);

	employeeButton = new JButton("Employee");
	slPanel.putConstraint(SpringLayout.NORTH, employeeButton, 100, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, employeeButton, 93, SpringLayout.WEST, pan);
	pan.add(employeeButton);

	JPanel rightPanel = new JPanel();
	contentPanel.add(rightPanel);
	setVisible(true);
}
 
@Override
protected JPanel createPatternsPanel() {
    JPanel patternsPanel = new JPanel(new SpringLayout());
    TitledBorder titledBorder = BorderFactory.createTitledBorder(Bundle.CTL_Panel_OutputPattern_Border_TitleText());
    titledBorder.setTitleJustification(TitledBorder.CENTER);
    patternsPanel.setBorder(titledBorder);

    TextFieldEditor textEditor = new TextFieldEditor();
    addTextField(patternsPanel, textEditor, Bundle.CTL_Label_ProgressPattern(),
                 ToolAdapterConstants.PROGRESS_PATTERN, false, null);
    propertyContainer.getDescriptor(ToolAdapterConstants.PROGRESS_PATTERN)
            .setValidator(new RegexFieldValidator());
    addTextField(patternsPanel, textEditor, Bundle.CTL_Label_StepPattern(),
                 ToolAdapterConstants.STEP_PATTERN, false, null);
    propertyContainer.getDescriptor(ToolAdapterConstants.STEP_PATTERN)
            .setValidator(new RegexFieldValidator());
    addTextField(patternsPanel, textEditor, Bundle.CTL_Label_ErrorPattern(),
                 ToolAdapterConstants.ERROR_PATTERN, false, null);
    propertyContainer.getDescriptor(ToolAdapterConstants.ERROR_PATTERN)
            .setValidator(new RegexFieldValidator());

    SpringUtilities.makeCompactGrid(patternsPanel, 3, 2,
                                    DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);

    return patternsPanel;
}
 
源代码6 项目: mpxj   文件: ObjectPropertiesView.java
/**
 * Constructor.
 *
 * @param model model used by this view
 */
public ObjectPropertiesView(ObjectPropertiesModel model)
{
   SpringLayout springLayout = new SpringLayout();
   setLayout(springLayout);

   JTable table = new JTable();
   JScrollPane scrollPane = new JScrollPane(table);
   springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 0, SpringLayout.NORTH, this);
   springLayout.putConstraint(SpringLayout.WEST, scrollPane, 0, SpringLayout.WEST, this);
   springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, 0, SpringLayout.SOUTH, this);
   springLayout.putConstraint(SpringLayout.EAST, scrollPane, 0, SpringLayout.EAST, this);
   add(scrollPane);

   PropertyConnector.connect(table, "model", model, "tableModel");
}
 
源代码7 项目: JavaMainRepo   文件: EmployeeFrame.java
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);
}
 
源代码8 项目: JavaMainRepo   文件: EmployeeFrame.java
/**
 * 
 * @param title
 *            The title of the frame.
 */
public EmployeeFrame(final String title) {
	super(title);
	contentPanel.setLayout(new GridLayout(0, 1, 0, 0));
	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);
	Caretaker = new JButton("Caretaker");
	slPanel.putConstraint(SpringLayout.NORTH, Caretaker, 180, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Caretaker, 280, SpringLayout.WEST, pan);
	pan.add(Caretaker);
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码9 项目: JavaMainRepo   文件: ListFrame.java
/**
 * 
 * @param title
 *            The title of the frame.
 */
public ListFrame(final String title) {
	super(title);
	contentPanel.setLayout(new GridLayout(0, 1, 0, 0));
	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);
	Animal = new JButton("Animal");
	slPanel.putConstraint(SpringLayout.NORTH, Animal, 0, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Animal, 0, SpringLayout.WEST, pan);
	pan.add(Animal);
	Employee = new JButton("Employee");
	slPanel.putConstraint(SpringLayout.NORTH, Employee, 0, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Employee, 78, SpringLayout.WEST, pan);
	pan.add(Employee);
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码10 项目: jdal   文件: SpringUtilities.java
private static SpringLayout.Constraints getConstraintsForCell(
                                            int row, int col,
                                            Container parent,
                                            int cols) {
    SpringLayout layout = (SpringLayout) parent.getLayout();
    Component c = parent.getComponent(row * cols + col);
    return layout.getConstraints(c);
}
 
源代码11 项目: swift-k   文件: SummaryPanel.java
private void fixEdges(SpringLayout l, JLabel label, JComponent c, JComponent container) {
    if (label == null) {
        l.putConstraint(SpringLayout.WEST, c, 5, SpringLayout.WEST, container);
        l.putConstraint(SpringLayout.EAST, c, -5, SpringLayout.EAST, container);
    }
    else {
        l.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, container);
        l.putConstraint(SpringLayout.WEST, c, 5, SpringLayout.EAST, label);
        l.putConstraint(SpringLayout.EAST, c, -5, SpringLayout.EAST, container);
        l.putConstraint(SpringLayout.NORTH, c, 0, SpringLayout.NORTH, label);
    }
}
 
源代码12 项目: gate-core   文件: SpringUtilities.java
private static SpringLayout.Constraints getConstraintsForCell(
                                            int row, int col,
                                            Container parent,
                                            int cols) {
    SpringLayout layout = (SpringLayout) parent.getLayout();
    Component c = parent.getComponent(row * cols + col);
    return layout.getConstraints(c);
}
 
源代码13 项目: swift-k   文件: SpringUtils.java
public static void gridLayout(JComponent c, int rows, int cols, int gap, boolean n, boolean s, boolean w, boolean e) {
    SpringLayout sl = new SpringLayout();
    c.setLayout(sl);
    for (int row = 0; row < rows; row++) {
        if (n) {
            if (row == 0) {
                sl.putConstraint(SpringLayout.NORTH, c.getComponent(0), 0, 
                    SpringLayout.NORTH, c);
            }
        }
        if (row != 0) {
            sl.putConstraint(SpringLayout.NORTH, c.getComponent(cols * row), gap, 
                SpringLayout.SOUTH, c.getComponent(cols * row - cols));
        }
        if (w) {
            sl.putConstraint(SpringLayout.WEST, c.getComponent(cols * row), 0, 
                SpringLayout.WEST, c);
        }
        for (int col = 1; col < cols; col++) {
            sl.putConstraint(SpringLayout.WEST, c.getComponent(cols * row + col), gap,
                SpringLayout.EAST, c.getComponent(cols * row + col - 1));
            sl.putConstraint(SpringLayout.SOUTH, c.getComponent(cols * row + col), 0,
                SpringLayout.SOUTH, c.getComponent(cols * row + col - 1));
            if (row != 0) {
                sl.putConstraint(SpringLayout.WEST, c.getComponent(cols * row + col), 0,
                SpringLayout.WEST, c.getComponent(cols * (row - 1) + col));
            }
        }
        if (e) {
            sl.putConstraint(SpringLayout.EAST, c.getComponent(cols * row + cols - 1), 0, 
                SpringLayout.EAST, c);
        }
        if (s) {
            if (row == rows - 1) {
                sl.putConstraint(SpringLayout.SOUTH, c.getComponent(cols * row), 0, 
                    SpringLayout.SOUTH, c);
            }
        }
    }
}
 
源代码14 项目: iBioSim   文件: SpringUtilities.java
private static SpringLayout.Constraints getConstraintsForCell(
                                            int row, int col,
                                            Container parent,
                                            int cols) {
    SpringLayout layout = (SpringLayout) parent.getLayout();
    Component c = parent.getComponent(row * cols + col);
    return layout.getConstraints(c);
}
 
源代码15 项目: swift-k   文件: SummaryPanel.java
public SummaryPanel(SystemState state) {
    this.state = state;
    this.start = state.getCurrentTime();
    SpringLayout l = new SpringLayout();
    setLayout(l);
    
    makeProgressBars(l);
    
    GlobalTimer.getTimer().schedule(new TimerTask() {
        public void run() {
            update();
        }
    }, 1000, 1000);
}
 
源代码16 项目: Astrosoft   文件: SpringUtilities.java
private static SpringLayout.Constraints getConstraintsForCell(
                                            int row, int col,
                                            Container parent,
                                            int cols) {
    SpringLayout layout = (SpringLayout) parent.getLayout();
    Component c = parent.getComponent(row * cols + col);
    return layout.getConstraints(c);
}
 
@Override
protected JPanel createBundlePanel() {
    JPanel bundlePanel = new JPanel(new SpringLayout());
    int rows = 0;
    bundleForm = new BundleForm(this.context,
                                newOperatorDescriptor.getWindowsBundle(),
                                newOperatorDescriptor.getLinuxBundle(),
                                newOperatorDescriptor.getMacosxBundle(),
                                newOperatorDescriptor.getVariables());
    bundlePanel.add(bundleForm);
    rows++;
    org.esa.snap.core.gpf.descriptor.dependency.Bundle currentBundle = newOperatorDescriptor.getBundle();
    JButton button = renderInstallButton(currentBundle, bundlePanel);
    JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.setMaximumSize(new Dimension(buttonPanel.getWidth(), controlHeight));
    buttonPanel.add(button, BorderLayout.EAST);
    bundlePanel.add(buttonPanel);
    bundleForm.setPropertyChangeListener(evt -> {
        org.esa.snap.core.gpf.descriptor.dependency.Bundle bundle =
                (org.esa.snap.core.gpf.descriptor.dependency.Bundle) evt.getSource();
        button.setText((bundle.getLocation() == BundleLocation.REMOTE ?
                "Download and " :
                "") + "Install Now");
        button.setToolTipText(bundle.getLocation() == BundleLocation.REMOTE ?
                                      bundle.getDownloadURL() :
                                      bundle.getSource() != null ?
                                              bundle.getSource().toString() : "");
        button.setMaximumSize(button.getPreferredSize());
        button.setVisible(canInstall(bundle));
    });
    rows++;
    SpringUtilities.makeCompactGrid(bundlePanel, rows, 1,
                                    DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);
    return bundlePanel;
}
 
源代码18 项目: mars-sim   文件: SpringUtilities.java
private static SpringLayout.Constraints getConstraintsForCell(
                                            int row, int col,
                                            Container parent,
                                            int cols) {
    SpringLayout layout = (SpringLayout) parent.getLayout();
    Component c = parent.getComponent(row * cols + col);
    return layout.getConstraints(c);
}
 
源代码19 项目: pcgen   文件: GameModePanel.java
@Override
public void setupDisplay(JPanel panel, final CDOMObject pc)
{
	panel.setLayout(layout);
	JLabel introLabel = new JLabel("Please select the Game Mode to Convert:");
	panel.add(introLabel);
	layout.putConstraint(SpringLayout.NORTH, introLabel, 50, SpringLayout.NORTH, panel);
	layout.putConstraint(SpringLayout.WEST, introLabel, 25, SpringLayout.WEST, panel);

	List<GameMode> games = SystemCollections.getUnmodifiableGameModeList();
	gameModeCombo = new JComboBox<>(games.toArray());
	gameModeCombo.addActionListener(arg0 -> {
		getSelection(pc);
		saveGameMode(pc);
	});
	PCGenSettings context = PCGenSettings.getInstance();
	SettingsHandler
		.setGame(context.initProperty(PCGenSettings.CONVERT_GAMEMODE, SettingsHandler.getGameAsProperty().get().getName()));
	GameMode currGame = SettingsHandler.getGameAsProperty().get();
	if (pc.get(ObjectKey.GAME_MODE) != null)
	{
		currGame = pc.get(ObjectKey.GAME_MODE);
	}
	gameModeCombo.setSelectedItem(currGame);
	getSelection(pc);
	saveGameMode(pc);

	panel.add(gameModeCombo);
	layout.putConstraint(SpringLayout.NORTH, gameModeCombo, 20, SpringLayout.SOUTH, introLabel);
	layout.putConstraint(SpringLayout.WEST, gameModeCombo, 25, SpringLayout.WEST, panel);
}
 
源代码20 项目: Astrosoft   文件: FileChooserPanel.java
public FileChooserPanel(Dimension size, String defaultPath, String title, FileOps.FileDialogMode mode, AstrosoftFileFilter fileFilter){
	
	this.defaultPath = defaultPath;
	this.title = title;
	this.mode = mode;
	this.fileFilter = fileFilter;
	setLayout(new SpringLayout());
	setPreferredSize(size);
	addComponents();
}
 
源代码21 项目: ganttproject   文件: ListAndFieldsPanel.java
public JComponent getComponent() {
  if (myPanel == null) {
    SpringLayout topPanelLayout = new SpringLayout();
    JPanel topPanel = new JPanel(topPanelLayout);

    JComponent depsComponent = myList.getTableComponent();
    JComponent titleComponent = new JLabel(myList.getTitle());
    JComponent actionsComponent = myList.getActionsComponent();
    topPanel.add(titleComponent);
    topPanel.add(actionsComponent);

    topPanelLayout.putConstraint(SpringLayout.WEST, titleComponent, 0, SpringLayout.WEST, topPanel);
    topPanelLayout.putConstraint(SpringLayout.NORTH, titleComponent, 0, SpringLayout.NORTH, topPanel);

    topPanelLayout.putConstraint(SpringLayout.NORTH, actionsComponent, 2, SpringLayout.SOUTH, titleComponent);
    topPanelLayout.putConstraint(SpringLayout.SOUTH, topPanel, 2, SpringLayout.SOUTH, actionsComponent);
    topPanelLayout.putConstraint(SpringLayout.WEST, actionsComponent, 0, SpringLayout.WEST, topPanel);

    JPanel centerPanel = new JPanel(new BorderLayout());
    centerPanel.add(depsComponent, BorderLayout.CENTER);

    myFields.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
    centerPanel.add(myFields, BorderLayout.EAST);

    myPanel = Box.createVerticalBox();
    myPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    myPanel.add(topPanel);
    myPanel.add(Box.createVerticalStrut(5));
    myPanel.add(centerPanel);
  }
  return myPanel;
}
 
源代码22 项目: snap-desktop   文件: ToolAdapterEditorDialog.java
@Override
protected JPanel createPreProcessingPanel() {
    final JPanel preProcessingPanel = new JPanel(new SpringLayout());

    PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor("preprocessorExternalTool");
    PropertyEditor editor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor);
    JComponent editorComponent = editor.createEditorComponent(propertyDescriptor, bindingContext);
    editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight));
    editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight));

    preProcessingPanel.add(createCheckboxComponent("preprocessTool", editorComponent, newOperatorDescriptor.getPreprocessTool()));
    preProcessingPanel.add(new JLabel(Bundle.CTL_Label_PreprocessingTool_Text()));
    preProcessingPanel.add(editorComponent);

    propertyDescriptor = propertyContainer.getDescriptor("processingWriter");
    editor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor);
    editorComponent = editor.createEditorComponent(propertyDescriptor, bindingContext);
    editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight));
    editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight));

    JComponent writeComponent = createCheckboxComponent("writeForProcessing", editorComponent, newOperatorDescriptor.shouldWriteBeforeProcessing());

    preProcessingPanel.add(writeComponent);
    preProcessingPanel.add(new JLabel(Bundle.CTL_Label_WriteBefore_Text()));
    preProcessingPanel.add(editorComponent);

    TitledBorder title = BorderFactory.createTitledBorder(Bundle.CTL_Panel_PreProcessing_Border_TitleText());
    preProcessingPanel.setBorder(title);

    SpringUtilities.makeCompactGrid(preProcessingPanel, 2, 3, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);

    return preProcessingPanel;
}
 
源代码23 项目: ganttproject   文件: CSVSettingsPanel.java
JComponent createSeparatorSettingsPanel() {
  JPanel result = new JPanel(new SpringLayout());
  result.add(new JLabel(language.getText("textSeparator")));
  cbTextSeparator = new JComboBox(getCsvOptions().getSeparatedTextChars());
  result.add(cbTextSeparator);

  result.add(new JLabel(language.getText("separatedFields")));
  myFieldSeparatorCombo = new JComboBox(new String[] { language.getText("fixedWidth"), language.getText("doubledot"),
      language.getText("dotComa"), language.getText("coma") });
  myFieldSeparatorCombo.setEditable(false);
  result.add(myFieldSeparatorCombo);
  SpringUtilities.makeCompactGrid(result, 2, 2, 0, 0, 3, 3);
  UIUtil.createTitle(result, language.getText("optionPage.impex.csv.group.csv.label"));
  return result;
}
 
源代码24 项目: pcgen   文件: GameModePanel.java
@Override
public void setupDisplay(JPanel panel, final CDOMObject pc)
{
	panel.setLayout(layout);
	JLabel introLabel = new JLabel("Please select the Game Mode to Convert:");
	panel.add(introLabel);
	layout.putConstraint(SpringLayout.NORTH, introLabel, 50, SpringLayout.NORTH, panel);
	layout.putConstraint(SpringLayout.WEST, introLabel, 25, SpringLayout.WEST, panel);

	List<GameMode> games = SystemCollections.getUnmodifiableGameModeList();
	gameModeCombo = new JComboBox<>(games.toArray());
	gameModeCombo.addActionListener(arg0 -> {
		getSelection(pc);
		saveGameMode(pc);
	});
	PCGenSettings context = PCGenSettings.getInstance();
	SettingsHandler
		.setGame(context.initProperty(PCGenSettings.CONVERT_GAMEMODE, SettingsHandler.getGameAsProperty().get().getName()));
	GameMode currGame = SettingsHandler.getGameAsProperty().get();
	if (pc.get(ObjectKey.GAME_MODE) != null)
	{
		currGame = pc.get(ObjectKey.GAME_MODE);
	}
	gameModeCombo.setSelectedItem(currGame);
	getSelection(pc);
	saveGameMode(pc);

	panel.add(gameModeCombo);
	layout.putConstraint(SpringLayout.NORTH, gameModeCombo, 20, SpringLayout.SOUTH, introLabel);
	layout.putConstraint(SpringLayout.WEST, gameModeCombo, 25, SpringLayout.WEST, panel);
}
 
源代码25 项目: JavaMainRepo   文件: MainMenuFrame.java
/**
 * 
 * @param title
 *            The title of the frame.
 */
public MainMenuFrame(final String title) {
	super(title);
	JPanel pan = new JPanel();
	SpringLayout slPanel = new SpringLayout();
	JLabel background = new JLabel(new ImageIcon("C:/Users/Bolo/Desktop/Zoo.png"));
	slPanel.putConstraint(SpringLayout.NORTH, background, 0, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, background, 0, SpringLayout.WEST, pan);
	pan.add(background);
	contentPanel.setLayout(new GridLayout(0, 3, 0, 0));
	JPanel panel = new JPanel();
	// adding empty panel to fill grid layout
	contentPanel.add(panel);
	contentPanel.add(pan);
	pan.setLayout(slPanel);
	btnAdd = new JButton("Add");
	slPanel.putConstraint(SpringLayout.NORTH, btnAdd, 65, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnAdd, 93, SpringLayout.WEST, pan);
	pan.add(btnAdd);
	btnList = new JButton("List");
	slPanel.putConstraint(SpringLayout.NORTH, btnList, 150, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnList, 94, SpringLayout.WEST, pan);
	pan.add(btnList);
	btnSaveAndExit = new JButton("Save and Exit");
	slPanel.putConstraint(SpringLayout.NORTH, btnSaveAndExit, 264, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnSaveAndExit, 69, SpringLayout.WEST, pan);
	pan.add(btnSaveAndExit);
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码26 项目: JavaMainRepo   文件: MainMenuFrame.java
public MainMenuFrame(String title) {
	super(title);
	contentPanel.setLayout(new GridLayout(0, 3, 0, 0));
	
	JPanel panel = new JPanel(); 
	// adding empty panel to fill grid layout
	contentPanel.add(panel);

	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);
	
	btnAdd = new JButton("Add");
	slPanel.putConstraint(SpringLayout.NORTH, btnAdd, 65, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnAdd, 93, SpringLayout.WEST, pan);
	pan.add(btnAdd);
	
	btnList = new JButton("List");
	slPanel.putConstraint(SpringLayout.NORTH, btnList, 150, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnList, 94, SpringLayout.WEST, pan);
	pan.add(btnList);
	
	btnSaveAndExit = new JButton("Save and Exit");
	slPanel.putConstraint(SpringLayout.NORTH, btnSaveAndExit, 264, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnSaveAndExit, 69, SpringLayout.WEST, pan);
	pan.add(btnSaveAndExit);
	
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码27 项目: JavaMainRepo   文件: MainMenuFrame.java
public MainMenuFrame(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);

	btnAdd = new JButton("Add");
	slPanel.putConstraint(SpringLayout.NORTH, btnAdd, 65, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnAdd, 93, SpringLayout.WEST, pan);
	pan.add(btnAdd);

	btnList = new JButton("List");
	slPanel.putConstraint(SpringLayout.NORTH, btnList, 150, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnList, 94, SpringLayout.WEST, pan);
	pan.add(btnList);

	btnSaveAndExit = new JButton("Save and Exit");
	slPanel.putConstraint(SpringLayout.NORTH, btnSaveAndExit, 264, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnSaveAndExit, 69, SpringLayout.WEST, pan);
	pan.add(btnSaveAndExit);

	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码28 项目: JavaMainRepo   文件: MainMenuFrame.java
public MainMenuFrame(String title) {
	super(title);
	
	contentPanel.setLayout(new GridLayout(0, 3, 0, 0));
	JPanel panel = new JPanel();
	
	// adding empty panel to fill grid layout
	
	contentPanel.add(panel);
	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);
	
	btnAdd = new JButton("Add");
	slPanel.putConstraint(SpringLayout.NORTH, btnAdd, 65, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnAdd, 93, SpringLayout.WEST, pan);
	pan.add(btnAdd);
	
	btnList = new JButton("List");
	slPanel.putConstraint(SpringLayout.NORTH, btnList, 150, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnList, 94, SpringLayout.WEST, pan);
	pan.add(btnList);
	
	btnSaveAndExit = new JButton("Save and Exit");
	slPanel.putConstraint(SpringLayout.NORTH, btnSaveAndExit, 264, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnSaveAndExit, 69, SpringLayout.WEST, pan);
	pan.add(btnSaveAndExit);
	
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码29 项目: JavaMainRepo   文件: MainMenuFrame.java
public MainMenuFrame(String title) {
	super(title);
	
	contentPanel.setLayout(new GridLayout(0, 3, 0, 0));
	JPanel panel = new JPanel();
	
	// adding empty panel to fill grid layout
	
	contentPanel.add(panel);
	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);
	
	btnAdd = new JButton("Add");
	slPanel.putConstraint(SpringLayout.NORTH, btnAdd, 65, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnAdd, 93, SpringLayout.WEST, pan);
	pan.add(btnAdd);
	
	btnList = new JButton("List");
	slPanel.putConstraint(SpringLayout.NORTH, btnList, 150, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnList, 94, SpringLayout.WEST, pan);
	pan.add(btnList);
	
	btnSaveAndExit = new JButton("Save and Exit");
	slPanel.putConstraint(SpringLayout.NORTH, btnSaveAndExit, 264, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnSaveAndExit, 69, SpringLayout.WEST, pan);
	pan.add(btnSaveAndExit);
	
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
源代码30 项目: JavaMainRepo   文件: AddFrame.java
public AddFrame(String title) {
	super(title);
	
	contentPanel.setLayout(new GridLayout(1,1,0,0));
	JPanel panSelect = new JPanel();
	
	contentPanel.add(panSelect);
	SpringLayout slPanel = new SpringLayout();
	panSelect.setLayout(slPanel);
	
	JLabel entityTypeLabel = new JLabel("Type of entity that will be added: \n");
	slPanel.putConstraint(SpringLayout.NORTH, entityTypeLabel, 8, SpringLayout.NORTH, panSelect);
	slPanel.putConstraint(SpringLayout.WEST, entityTypeLabel, 5, SpringLayout.WEST, panSelect);
	
	cBoxSpecies = new JComboBox<String>(Constants.Arrays.Species);
	cBoxSpecies.setSelectedIndex(0);
	slPanel.putConstraint(SpringLayout.NORTH, cBoxSpecies, 5, SpringLayout.NORTH, panSelect);
	slPanel.putConstraint(SpringLayout.WEST, cBoxSpecies, 200, SpringLayout.WEST, panSelect);
	
	cBoxAnimal = new JComboBox<String>(Constants.Arrays.Aquatics);
	cBoxAnimal.setSelectedIndex(0);
	slPanel.putConstraint(SpringLayout.NORTH, cBoxAnimal, 5, SpringLayout.NORTH, panSelect);
	slPanel.putConstraint(SpringLayout.WEST, cBoxAnimal, 300, SpringLayout.WEST, panSelect);
	
	btnNext = new JButton("Next");
	btnNext.setPreferredSize(new Dimension(150, 100));
	slPanel.putConstraint(SpringLayout.NORTH, btnNext, 60, SpringLayout.NORTH, panSelect);
	slPanel.putConstraint(SpringLayout.WEST, btnNext, 175, SpringLayout.WEST, panSelect);
	
	panSelect.add(entityTypeLabel);
	panSelect.add(cBoxSpecies);
	panSelect.add(cBoxAnimal);
	panSelect.add(btnNext);
	
	setVisible(true);
}
 
点击广告?(赏赐笔者)
 类所在包
 同包方法