Java Code Examples for javax.swing.JPanel#setMaximumSize()

The following examples show how to use javax.swing.JPanel#setMaximumSize() . 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: ToolAdapterTabbedEditorDialog.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private JPanel createPreProcessingTab() {
    JPanel preprocessAndPatternsPanel = new JPanel(new SpringLayout());
    preprocessAndPatternsPanel.add(createPreProcessingPanel());
    SpringUtilities.makeCompactGrid(preprocessAndPatternsPanel, 1, 1,
                                    DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);
    preprocessAndPatternsPanel.setMaximumSize(preprocessAndPatternsPanel.getSize());
    return preprocessAndPatternsPanel;
}
 
Example 2
Source File: BasicReplaceResultsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void init() {
    JPanel leftPanel = new JPanel();
    replaceButton = new JButton();
    replaceButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            replace();
        }
    });
    updateReplaceButton();
    leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS));
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.LEADING, 2, 1));
    buttonPanel.add(replaceButton);
    replaceButton.setMaximumSize(replaceButton.getPreferredSize());
    buttonPanel.setMaximumSize(new Dimension( // #225246
            (int) buttonPanel.getMaximumSize().getWidth(),
            (int) buttonPanel.getPreferredSize().getHeight()));
    leftPanel.add(resultsOutlineSupport.getOutlineView());
    leftPanel.add(buttonPanel);

    this.splitPane = new JSplitPane();
    splitPane.setLeftComponent(leftPanel);
    splitPane.setRightComponent(new ContextView(resultModel,
            getExplorerManager()));
    initSplitDividerLocationHandling();

    getContentPanel().add(splitPane);
    initResultModelListener();
    replaceButton.getAccessibleContext().setAccessibleDescription(
            NbBundle.getMessage(ResultView.class,
            "ACS_TEXT_BUTTON_REPLACE"));                            //NOI18N
}
 
Example 3
Source File: GUIFilterConfigAddDialog.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
private JComponent buttons() {
    JPanel panel_button = new JPanel();
    panel_button.setLayout(new BoxLayout(panel_button, BoxLayout.X_AXIS));
    panel_button.setMaximumSize(new Dimension(Short.MAX_VALUE, button_set.getMaximumSize().height));
    panel_button.add(button_cancel);
    panel_button.add(button_set);
    return panel_button;
}
 
Example 4
Source File: CompoundDemoFrame.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected Container createDefaultContentPane()
{

  demoContent = new JPanel();
  demoContent.setLayout(new BorderLayout());
  demoContent.setMinimumSize(new Dimension(100, 100));
  demoContent.add(getNoHandlerInfoPane(), BorderLayout.CENTER);

  JPanel placeHolder = new JPanel();
  placeHolder.setMinimumSize(new Dimension(300, 0));
  placeHolder.setPreferredSize(new Dimension(300, 0));
  placeHolder.setMaximumSize(new Dimension(300, 0));

  JPanel rootContent = new JPanel();
  rootContent.setLayout(new BorderLayout());
  rootContent.add(demoContent, BorderLayout.CENTER);
  rootContent.add(placeHolder, BorderLayout.NORTH);

  final DemoSelectorTreeNode root = new DemoSelectorTreeNode(null,
      demoSelector);
  final DefaultTreeModel model = new DefaultTreeModel(root);
  final JTree demoTree = new JTree(model);
  demoTree.addTreeSelectionListener(new TreeSelectionHandler());

  JSplitPane rootSplitPane =
      new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
          new JScrollPane(demoTree), rootContent);
  rootSplitPane.setContinuousLayout(true);
  rootSplitPane.setDividerLocation(200);
  rootSplitPane.setOneTouchExpandable(true);
  return rootSplitPane;
}
 
Example 5
Source File: InfoPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JPanel createSeparator() {
    JPanel panel = new JPanel();
    panel.setBackground(javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    panel.setMaximumSize(new java.awt.Dimension(32767, 1));
    panel.setMinimumSize(new java.awt.Dimension(10, 1));
    panel.setPreferredSize(new java.awt.Dimension(0, 1));
    return panel;
}
 
Example 6
Source File: GUIOptionServerDialog.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
private JComponent buttons() {
    JPanel panel_button = new JPanel();
    panel_button.setLayout(new BoxLayout(panel_button, BoxLayout.X_AXIS));
    panel_button.setMaximumSize(new Dimension(Short.MAX_VALUE, button_set.getMaximumSize().height));
    panel_button.add(button_cancel);
    panel_button.add(button_set);
    return panel_button;
}
 
Example 7
Source File: ScopeOptionsController.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize panel for controls for scope options and add it to the form
 * panel.
 */
private void initScopeOptionsRow(boolean searchAndReplace) {

    JPanel regexpPanel = new CheckBoxWithButtonPanel(
            chkFileNameRegex, btnTestFileNamePattern);
    if (fileNameComponent != null) {
        fileNameComponent.setLayout(
                new FlowLayout(FlowLayout.LEADING, 0, 0));
        fileNameComponent.add(ignoreListOptionPanel);
        fileNameComponent.add(regexpPanel);
        if (!searchAndReplace) {
            component.add(chkArchives);
            component.add(chkGenerated);
        }
    } else {
        JPanel jp = new JPanel();
        if (searchAndReplace) {
            jp.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
            jp.add(ignoreListOptionPanel);
            jp.add(regexpPanel);
            jp.setMaximumSize(jp.getMinimumSize());
        } else {
            FormLayoutHelper flh = new FormLayoutHelper(jp,
                    FormLayoutHelper.DEFAULT_COLUMN,
                    FormLayoutHelper.DEFAULT_COLUMN);
            flh.addRow(chkArchives, chkGenerated);
            flh.addRow(ignoreListOptionPanel,
                    new CheckBoxWithButtonPanel(
                    chkFileNameRegex, btnTestFileNamePattern));
            jp.setMaximumSize(jp.getMinimumSize());
        }
        component.add(jp);
    }
}
 
Example 8
Source File: GUIFilterConfigEditDialog.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
private JComponent buttons() {
    JPanel panel_button = new JPanel();
    panel_button.setLayout(new BoxLayout(panel_button, BoxLayout.X_AXIS));
    panel_button.setMaximumSize(new Dimension(Short.MAX_VALUE, button_set.getMaximumSize().height));
    panel_button.add(button_cancel);
    panel_button.add(button_set);
    return panel_button;
}
 
Example 9
Source File: UI.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
public static JPanel createSearchPanel(JTextField searchBox) {
  JPanel searchPanel = new JPanel();
  searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.LINE_AXIS));
  searchPanel.setBackground(UI.BACKGROUND);
  searchPanel.setMaximumSize(new Dimension(220, 50));
  searchPanel.setBorder(new LineBorder(Color.BLACK, 2));
  searchPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
  searchPanel.add(searchBox);
  return searchPanel;
}
 
Example 10
Source File: GUIOptionComponentBase.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
private JPanel createTableButton(ActionListener addAction, ActionListener editAction, ActionListener removeAction) {
	JPanel panel = new JPanel();

	JButton button_add = new JButton("Add");
	JButton button_edit = new JButton("Edit");
	JButton button_remove = new JButton("Remove");

	int height = button_add.getMinimumSize().height;

	button_add.setMaximumSize(new Dimension(100,height));
	button_edit.setMaximumSize(new Dimension(100,height));
	button_remove.setMaximumSize(new Dimension(100,height));

	if(null!=addAction) {
		panel.add(button_add);
		button_add.addActionListener(addAction);
	}

	if(null!=editAction) {
		panel.add(button_edit);
		button_edit.addActionListener(editAction);
	}

	if(null!=removeAction) {
		panel.add(button_remove);
		button_remove.addActionListener(removeAction);
	}

	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
	panel.setBackground(Color.WHITE);
	panel.setMaximumSize(new Dimension(100, panel.getMinimumSize().height));
	panel.setAlignmentY(Component.TOP_ALIGNMENT);
	return panel;
}
 
Example 11
Source File: ActiveConfigAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Component getToolbarPresenter() {
    // Do not return combo box directly; looks bad.
    JPanel toolbarPanel = new JPanel(new GridBagLayout());
    toolbarPanel.setOpaque(false); // don't interrupt JToolBar background
    toolbarPanel.setMaximumSize(new Dimension(150, 80));
    toolbarPanel.setMinimumSize(new Dimension(150, 0));
    toolbarPanel.setPreferredSize(new Dimension(150, 23));
    initConfigListCombo();
    // XXX top inset of 2 looks better w/ small toolbar, but 1 seems to look better for large toolbar (the default):
    toolbarPanel.add(configListCombo, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 6, 1, 5), 0, 0));
    return toolbarPanel;
}
 
Example 12
Source File: MeanShiftDemo.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 50, ColourSpace.RGB);
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	ic.addMouseListener(this);
	ic.addMouseMotionListener(this);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	clearBtn = new JButton("Clear");
	clearBtn.setActionCommand("button.clear");
	clearBtn.addActionListener(this);
	controls.add(clearBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	controls.add(new JLabel("H:"));
	hSpn = new JSpinner(new SpinnerNumberModel(30, 1, 100, 5));
	controls.add(hSpn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run Mean Shift");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
Example 13
Source File: KMeansDemo.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 50, ColourSpace.RGB);
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	ic.addMouseListener(this);
	ic.addMouseMotionListener(this);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	clearBtn = new JButton("Clear");
	clearBtn.setActionCommand("button.clear");
	clearBtn.addActionListener(this);
	controls.add(clearBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("K:"));

	kSpn = new JSpinner(new SpinnerNumberModel(1, 1, 10, 1));
	controls.add(kSpn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("Distance:"));

	distCombo = new JComboBox<String>();
	distCombo.addItem("Euclidean");
	distCombo.addItem("Manhatten");
	distCombo.addItem("Cosine Distance");
	controls.add(distCombo);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run KMeans");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
Example 14
Source File: ViewMapping.java    From AML-Project with Apache License 2.0 4 votes vote down vote up
private void buildDetailPanel()
{
	//Setup the panels
	details = new JPanel();
	details.setLayout(new BoxLayout(details, BoxLayout.Y_AXIS));
	JPanel topFiller = new JPanel();
	topFiller.setPreferredSize(new Dimension(topFiller.getPreferredSize().width,10));
	topFiller.setMaximumSize(new Dimension(topFiller.getMaximumSize().width,10));
	details.add(topFiller);
	
	if(t.equals(EntityType.CLASS))
	{
		sourcePanel = buildClassDetailPanel(sourceId);
		sourcePanel.setBorder(new TitledBorder("Source Class:"));
		targetPanel = buildClassDetailPanel(targetId);
		targetPanel.setBorder(new TitledBorder("Target Class:"));
	}
	else if(t.equals(EntityType.INDIVIDUAL))
	{
		sourcePanel = buildIndivDetailPanel(sourceId);
		sourcePanel.setBorder(new TitledBorder("Source Individual:"));
		targetPanel = buildIndivDetailPanel(targetId);
		targetPanel.setBorder(new TitledBorder("Target Individual:"));
	}
	else
	{
		sourcePanel = buildPropDetailPanel(sourceId);
		sourcePanel.setBorder(new TitledBorder("Source Property:"));
		targetPanel = buildPropDetailPanel(targetId);
		targetPanel.setBorder(new TitledBorder("Target Property:"));
	}
	
	//Set the sizes of the subpanels and add them to the details panel
	sourcePanel.setPreferredSize(new Dimension((int)(width*0.85),sourcePanel.getPreferredSize().height));
	sourcePanel.setMaximumSize(new Dimension((int)(width*0.85),sourcePanel.getPreferredSize().height));
	details.add(sourcePanel);
	JPanel midFiller1 = new JPanel();
	midFiller1.setPreferredSize(new Dimension(midFiller1.getPreferredSize().width,10));
	midFiller1.setMaximumSize(new Dimension(midFiller1.getMaximumSize().width,10));
	details.add(midFiller1);
	targetPanel.setPreferredSize(new Dimension((int)(width*0.85),targetPanel.getPreferredSize().height));
	targetPanel.setMaximumSize(new Dimension((int)(width*0.85),targetPanel.getPreferredSize().height));
	details.add(targetPanel);
	JPanel midFiller2 = new JPanel();
	midFiller2.setPreferredSize(new Dimension(midFiller2.getPreferredSize().width,10));
	midFiller2.setMaximumSize(new Dimension(midFiller2.getMaximumSize().width,10));
	details.add(midFiller2);
	//Initialize and construct the mapping panel
	JPanel mappingPanel = new JPanel();
	mappingPanel.setLayout(new BoxLayout(mappingPanel, BoxLayout.Y_AXIS));
	mappingPanel.setBorder(new TitledBorder("Mapping:"));
       JLabel type = new JLabel("<html>Type: <i>" + t + " Mapping</i></html>");
	mappingPanel.add(type);
       JLabel sim = new JLabel("<html>Final Similarity: <i>" + m.getSimilarityPercent() + "</i></html>");
       mappingPanel.add(sim);
       if(t.equals(EntityType.CLASS))
       {
        QualityFlagger qf = aml.getQualityFlagger();
        if(qf != null)
        {
        	Vector<String> labels = qf.getLabels();
        	for(int i = 0; i < labels.size(); i++)
        	{
        		JLabel simQ = new JLabel("<html>" + labels.get(i) + "<i>" +
        				qf.getSimilarityPercent(sourceId,targetId,i) + "</i></html>");
        		mappingPanel.add(simQ);
        	}
        }
       }
	//Set its size and add it to the details panel
	mappingPanel.setPreferredSize(new Dimension((int)(width*0.85),mappingPanel.getPreferredSize().height));
	mappingPanel.setMaximumSize(new Dimension((int)(width*0.85),mappingPanel.getPreferredSize().height));
	details.add(mappingPanel);
	JPanel bottomFiller = new JPanel();
	details.add(bottomFiller);
}
 
Example 15
Source File: MDSDemo.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	chart = ChartFactory.createScatterPlot("", "", "", dataset, PlotOrientation.VERTICAL, false, false, false);

	final XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true) {
		private static final long serialVersionUID = 1L;

		@Override
		public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) {
			return new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_LEFT);
		}
	};
	final Font font = Font.decode("Helvetica Neue-22");
	renderer.setBaseItemLabelFont(font);
	chart.getXYPlot().setRenderer(renderer);
	// chart.getXYPlot().getDomainAxis().setRange(-0.5, 5.5)
	chart.getXYPlot().getDomainAxis().setTickLabelFont(font);
	// chart.getXYPlot().getDomainAxis().setTickUnit(new NumberTickUnit(1))
	// chart.getXYPlot().getRangeAxis().setRange(-0.5, 5.5)
	chart.getXYPlot().getRangeAxis().setTickLabelFont(font);
	// chart.getXYPlot().getRangeAxis().setTickUnit(new NumberTickUnit(1))

	chart.getXYPlot().getRenderer().setBaseItemLabelGenerator(new StandardXYItemLabelGenerator() {
		private static final long serialVersionUID = 1L;

		@Override
		public String generateLabel(XYDataset ds, int series, int item) {
			return ((Dataset) ds).getLabel(series, item);
		};
	});
	chart.getXYPlot().getRenderer().setBaseItemLabelsVisible(true);

	chartPanel = new ChartPanel(chart);
	chart.setBackgroundPaint(new java.awt.Color(255, 255, 255, 255));
	chart.getXYPlot().setBackgroundPaint(java.awt.Color.WHITE);
	chart.getXYPlot().setRangeGridlinePaint(java.awt.Color.GRAY);
	chart.getXYPlot().setDomainGridlinePaint(java.awt.Color.GRAY);

	chartPanel.setSize(width, height - 50);
	chartPanel.setPreferredSize(chartPanel.getSize());
	base.add(chartPanel);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("Distance:"));

	distCombo = new JComboBox<String>();
	distCombo.addItem("Euclidean");
	distCombo.addItem("1-Pearson");
	distCombo.addItem("1-Cosine");
	controls.add(distCombo);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run MDS");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	iterLabel = new JLabel("                         ");
	final Dimension size = iterLabel.getPreferredSize();
	iterLabel.setMinimumSize(size);
	iterLabel.setPreferredSize(size);
	controls.add(iterLabel);

	updateImage();

	return base;
}
 
Example 16
Source File: HClusterDemo.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 50, ColourSpace.RGB);
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	ic.addMouseListener(this);
	ic.addMouseMotionListener(this);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	clearBtn = new JButton("Clear");
	clearBtn.setActionCommand("button.clear");
	clearBtn.addActionListener(this);
	controls.add(clearBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("Distance:"));

	distCombo = new JComboBox<String>();
	distCombo.addItem("Euclidean");
	distCombo.addItem("Manhatten");
	distCombo.addItem("Cosine Distance");
	controls.add(distCombo);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("Linkage:"));

	linkCombo = new JComboBox<String>();
	for (final Linkage s : Linkage.values())
		linkCombo.addItem(s.name());
	controls.add(linkCombo);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run HAC");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
Example 17
Source File: ToolAdapterEditorDialog.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected JPanel createVariablesPanel() {
    JPanel variablesBorderPanel = new JPanel();
    BoxLayout layout = new BoxLayout(variablesBorderPanel, BoxLayout.PAGE_AXIS);
    variablesBorderPanel.setLayout(layout);
    variablesBorderPanel.setBorder(BorderFactory.createTitledBorder(Bundle.CTL_Panel_SysVar_Border_TitleText()));

    AbstractButton addVariableButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addVariableButton.setText(Bundle.CTL_Button_Add_Variable_Text());
    addVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    addVariableButton.setMaximumSize(new Dimension(150, controlHeight));

    AbstractButton addDependentVariableButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addDependentVariableButton.setText(Bundle.CTL_Button_Add_PDVariable_Text());
    addDependentVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    addDependentVariableButton.setMaximumSize(new Dimension(250, controlHeight));

    JPanel buttonsPannel = new JPanel(new SpringLayout());
    buttonsPannel.add(addVariableButton);
    buttonsPannel.add(addDependentVariableButton);
    SpringUtilities.makeCompactGrid(buttonsPannel, 1, 2, 0, 0, 0, 0);
    buttonsPannel.setAlignmentX(Component.LEFT_ALIGNMENT);
    variablesBorderPanel.add(buttonsPannel);

    varTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    varTable.setRowHeight(20);
    JScrollPane scrollPane = new JScrollPane(varTable);
    scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    variablesBorderPanel.add(scrollPane);
    variablesBorderPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    Dimension variablesPanelDimension = new Dimension((formWidth - 3 * DEFAULT_PADDING) / 2 - 2 * DEFAULT_PADDING, 130);
    variablesBorderPanel.setMinimumSize(variablesPanelDimension);
    variablesBorderPanel.setMaximumSize(variablesPanelDimension);
    variablesBorderPanel.setPreferredSize(variablesPanelDimension);

    addVariableButton.addActionListener(e -> {
        newOperatorDescriptor.getVariables().add(new SystemVariable("key", ""));
        varTable.revalidate();
    });

    addDependentVariableButton.addActionListener(e -> {
        newOperatorDescriptor.getVariables().add(new SystemDependentVariable("key", ""));
        varTable.revalidate();
    });

    return variablesBorderPanel;
}
 
Example 18
Source File: MainWindow.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
private void createTabs() {
	CustomButton btnAllTab = new CustomButton(StringResource.get("ALL_DOWNLOADS")),
			btnIncompleteTab = new CustomButton(StringResource.get("ALL_UNFINISHED")),
			btnCompletedTab = new CustomButton(StringResource.get("ALL_FINISHED"));

	btnTabArr = new CustomButton[3];
	btnTabArr[0] = btnAllTab;
	btnTabArr[0].setName("ALL_DOWNLOADS");
	btnTabArr[1] = btnIncompleteTab;
	btnTabArr[1].setName("ALL_UNFINISHED");
	btnTabArr[2] = btnCompletedTab;
	btnTabArr[2].setName("ALL_FINISHED");

	for (int i = 0; i < 3; i++) {
		btnTabArr[i].setFont(FontResource.getBigBoldFont());
		btnTabArr[i].setBorderPainted(false);
		btnTabArr[i].setFocusPainted(false);
		btnTabArr[i].addActionListener(this);
	}

	btnAllTab.setBackground(ColorResource.getActiveTabColor());
	btnAllTab.setForeground(ColorResource.getDarkBgColor());

	btnIncompleteTab.setBackground(ColorResource.getTitleColor());
	btnIncompleteTab.setForeground(ColorResource.getDeepFontColor());

	btnCompletedTab.setBackground(ColorResource.getTitleColor());
	btnCompletedTab.setForeground(ColorResource.getDeepFontColor());

	JPanel p = new JPanel(new GridLayout(1, 3, scale(5), 0));
	p.setBorder(null);
	p.setOpaque(false);
	Dimension d = new Dimension(scale(380), scale(30));
	p.setPreferredSize(d);
	p.setMaximumSize(d);
	p.setMinimumSize(d);
	p.setBackground(Color.WHITE);
	p.add(btnAllTab);
	p.add(btnIncompleteTab);
	p.add(btnCompletedTab);

	p.setAlignmentX(Box.RIGHT_ALIGNMENT);

	this.rightbox.add(p);

	// pp.add(p, BorderLayout.EAST);

	// getTitlePanel().add(pp, BorderLayout.SOUTH);
}
 
Example 19
Source File: SOMDemo.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 56, ColourSpace.RGB);
	som = new float[(height - 56) / somfactor][width / somfactor][rawdata.getTerms().size()];
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 56));
	controls.setMaximumSize(new Dimension(width, 56));
	controls.setSize(new Dimension(width, 56));

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run SOM");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
Example 20
Source File: MapDemo.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public SimpleTableDemo(LazyReplicatedMap<String,StringBuilder> map) {
    super();
    this.map = map;

    this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

    //final JTable table = new JTable(data, columnNames);
    table = new JTable(dataModel);

    table.setPreferredScrollableViewportSize(new Dimension(WIDTH, 150));
    for ( int i=0; i<table.getColumnCount(); i++ ) {
        TableColumn tm = table.getColumnModel().getColumn(i);
        tm.setCellRenderer(new ColorRenderer());
    }


    if (DEBUG) {
        table.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                printDebugData(table);
            }
        });
    }

    //setLayout(new GridLayout(5, 0));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    //Add the scroll pane to this panel.
    add(scrollPane);

    //create a add value button
    JPanel addpanel = new JPanel();
    addpanel.setPreferredSize(new Dimension(WIDTH,30));
    addpanel.add(createButton("Add","add"));
    addpanel.add(txtAddKey);
    addpanel.add(txtAddValue);
    addpanel.setMaximumSize(new Dimension(WIDTH,30));
    add(addpanel);

    //create a remove value button
    JPanel removepanel = new JPanel( );
    removepanel.setPreferredSize(new Dimension(WIDTH,30));
    removepanel.add(createButton("Remove","remove"));
    removepanel.add(txtRemoveKey);
    removepanel.setMaximumSize(new Dimension(WIDTH,30));
    add(removepanel);

    //create a change value button
    JPanel changepanel = new JPanel( );
    changepanel.add(createButton("Change","change"));
    changepanel.add(txtChangeKey);
    changepanel.add(txtChangeValue);
    changepanel.setPreferredSize(new Dimension(WIDTH,30));
    changepanel.setMaximumSize(new Dimension(WIDTH,30));
    add(changepanel);


    //create sync button
    JPanel syncpanel = new JPanel( );
    syncpanel.add(createButton("Synchronize","sync"));
    syncpanel.add(createButton("Replicate","replicate"));
    syncpanel.add(createButton("Random","random"));
    syncpanel.setPreferredSize(new Dimension(WIDTH,30));
    syncpanel.setMaximumSize(new Dimension(WIDTH,30));
    add(syncpanel);


}