javax.swing.SpringLayout Java Examples

The following examples show how to use javax.swing.SpringLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ObjectPropertiesView.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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");
}
 
Example #2
Source File: EmployeeFrame.java    From JavaMainRepo with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @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);
}
 
Example #3
Source File: ToolAdapterTabbedEditorDialog.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example #4
Source File: MainMenuFrame.java    From JavaMainRepo with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #5
Source File: AddFrame.java    From JavaMainRepo with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #6
Source File: EmployeeFrame.java    From JavaMainRepo with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #7
Source File: ListFrame.java    From JavaMainRepo with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @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);
}
 
Example #8
Source File: EmployeeFrame.java    From JavaMainRepo with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #9
Source File: GUIServerNamePanel.java    From PacketProxy with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #10
Source File: MainMenuFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #11
Source File: ToolAdapterEditorDialog.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example #12
Source File: ListAndFieldsPanel.java    From ganttproject with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #13
Source File: SpringUtilities.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #14
Source File: AquaticFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
public AquaticFrame(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);

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

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

	swordfishButton = new JButton("Swordfish");
	slPanel.putConstraint(SpringLayout.NORTH, swordfishButton, 135, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, swordfishButton, 93, SpringLayout.WEST, pan);
	pan.add(swordfishButton);

	JPanel rightPanel = new JPanel();
	contentPanel.add(rightPanel);
	setVisible(true);

}
 
Example #15
Source File: SwingSelfDrillDownUi.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Create Swing version of the self-drilldown.xul dialog.
 */
public SwingSelfDrillDownUi() {
  SpringLayout layout = new SpringLayout();
  final int layoutIndent = 2;

  editor = new JPanel();
  editor.setLayout( layout );

  /** "Target:" and "Tooltip:" input fields */
  tatPanel = new TooltipAndTargetPanel();
  tatPanel.getTargetComboBox().addItemListener( new ItemListener() {
    public void itemStateChanged( final ItemEvent e ) {
      getModel().setTargetFormula( e.getItem().toString() );
    }
  } );
  tatPanel.getTooltipPanel().addPropertyChangeListener( "formula", new PropertyChangeListener() {
    public void propertyChange( final PropertyChangeEvent evt ) {
      getModel().setTooltipFormula( evt.getNewValue().toString() );
    }
  } );
  editor.add( tatPanel );
  layout.putConstraint( SpringLayout.NORTH, tatPanel, layoutIndent, SpringLayout.NORTH, editor );
  layout.putConstraint( SpringLayout.EAST, tatPanel, -layoutIndent, SpringLayout.EAST, editor );
  layout.putConstraint( SpringLayout.WEST, tatPanel, layoutIndent, SpringLayout.WEST, editor );

  /** "Parameter:" input table */
  table = new DrillDownParameterTable();
  table.setShowRefreshButton( false );
  table.setAllowCustomParameter( true );
  table.setSingleTabMode( true );
  table.setShowHideParameterUiCheckbox( false );
  table.addDrillDownParameterRefreshListener( new UpdateParametersHandler() );
  table.addPropertyChangeListener( DrillDownParameterTable.DRILL_DOWN_PARAMETER_PROPERTY, new TableModelBinding() );

  editor.add( table );
  layout.putConstraint( SpringLayout.NORTH, table, layoutIndent, SpringLayout.SOUTH, tatPanel );
  layout.putConstraint( SpringLayout.EAST, table, -layoutIndent, SpringLayout.EAST, editor );
  layout.putConstraint( SpringLayout.SOUTH, table, -layoutIndent, SpringLayout.SOUTH, editor );
  layout.putConstraint( SpringLayout.WEST, table, layoutIndent, SpringLayout.WEST, editor );
}
 
Example #16
Source File: ReptileFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
public ReptileFrame(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);

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

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

	viperButton = new JButton("Viper");
	slPanel.putConstraint(SpringLayout.NORTH, viperButton, 135, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, viperButton, 93, SpringLayout.WEST, pan);
	pan.add(viperButton);

	JPanel rightPanel = new JPanel();
	contentPanel.add(rightPanel);
	setVisible(true);

}
 
Example #17
Source File: SpringUtilities.java    From Astrosoft with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #18
Source File: AnimalFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param title
 *            The title of the frame.
 */
public AnimalFrame(final String title) {
	super(title);
	contentPanel.setLayout(new GridLayout(0, 1, 0, 0));
	// JPanel panel = new JPanel();
	// contentPanel.add(panel);
	JPanel pan = new JPanel();
	contentPanel.add(pan);
	SpringLayout slPanel = new SpringLayout();
	pan.setLayout(slPanel);
	Aquatic = new JButton("Aquatic");
	slPanel.putConstraint(SpringLayout.NORTH, Aquatic, 0, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Aquatic, 0, SpringLayout.WEST, pan);
	pan.add(Aquatic);
	Bird = new JButton("Bird");
	slPanel.putConstraint(SpringLayout.NORTH, Bird, 0, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Bird, 78, SpringLayout.WEST, pan);
	pan.add(Bird);
	Insect = new JButton("Insect");
	slPanel.putConstraint(SpringLayout.NORTH, Insect, 0, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Insect, 136, SpringLayout.WEST, pan);
	pan.add(Insect);
	Mammal = new JButton("Mammal");
	slPanel.putConstraint(SpringLayout.NORTH, Mammal, 0, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Mammal, 206, SpringLayout.WEST, pan);
	pan.add(Mammal);
	Reptile = new JButton("Reptile");
	slPanel.putConstraint(SpringLayout.NORTH, Reptile, 0, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, Reptile, 290, SpringLayout.WEST, pan);
	pan.add(Reptile);
	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
Example #19
Source File: SummaryPanel.java    From swift-k with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #20
Source File: CSVSettingsPanel.java    From ganttproject with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #21
Source File: SpringUtilities.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #22
Source File: GameModePanel.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
@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);
}
 
Example #23
Source File: MainMenuFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @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);
}
 
Example #24
Source File: AquaticFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
public AquaticFrame(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);

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

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

	swordfishButton = new JButton("Swordfish");
	slPanel.putConstraint(SpringLayout.NORTH, swordfishButton, 135, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, swordfishButton, 93, SpringLayout.WEST, pan);
	pan.add(swordfishButton);

	JPanel rightPanel = new JPanel();
	contentPanel.add(rightPanel);
	setVisible(true);

}
 
Example #25
Source File: MainMenuFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #26
Source File: MainMenuFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
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, 50, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnAdd, Constants.Frames.WIDTH/6-20, SpringLayout.WEST, pan);
	pan.add(btnAdd);
	btnList = new JButton("List");
	slPanel.putConstraint(SpringLayout.NORTH, btnList, 100, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnList, Constants.Frames.WIDTH/6-20, SpringLayout.WEST, pan);
	pan.add(btnList);
	btnLoadFromXml = new JButton("Load from XML");
	slPanel.putConstraint(SpringLayout.NORTH, btnLoadFromXml, 150, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnLoadFromXml, Constants.Frames.WIDTH/6-48, SpringLayout.WEST, pan);
	pan.add(btnLoadFromXml);
	btnSaveAndExit = new JButton("Save and Exit");
	slPanel.putConstraint(SpringLayout.NORTH, btnSaveAndExit, 200, SpringLayout.NORTH, pan);
	slPanel.putConstraint(SpringLayout.WEST, btnSaveAndExit, Constants.Frames.WIDTH/6-48, SpringLayout.WEST, pan);
	pan.add(btnSaveAndExit);

	JPanel panel_2 = new JPanel();
	contentPanel.add(panel_2);
	setVisible(true);
}
 
Example #27
Source File: MainMenuFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #28
Source File: MainMenuFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #29
Source File: MainMenuFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #30
Source File: AddFrame.java    From JavaMainRepo with Apache License 2.0 5 votes vote down vote up
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);
}