javax.swing.JComponent#setMinimumSize ( )源码实例Demo

下面列出了javax.swing.JComponent#setMinimumSize ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: CQL   文件: AqlViewer.java
private <X, Y> JScrollPane makeList2(
		Algebra<catdata.aql.exp.Ty, catdata.aql.exp.En, catdata.aql.exp.Sym, catdata.aql.exp.Fk, catdata.aql.exp.Att, catdata.aql.exp.Gen, catdata.aql.exp.Sk, X, Y> algebra,
		boolean b, int l) {
	List<JComponent> list = makeList(algebra, b, l);

	JPanel c = new JPanel();
	c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS));

	for (JComponent x : list) {
		x.setAlignmentX(Component.LEFT_ALIGNMENT);
		x.setMinimumSize(x.getPreferredSize());
		c.add(x);
	}

	JPanel p = new JPanel(new GridLayout(1, 1));
	p.add(c);
	JScrollPane jsp = new JScrollPane(p);

	c.setBorder(BorderFactory.createEmptyBorder());
	p.setBorder(BorderFactory.createEmptyBorder());
	jsp.setBorder(BorderFactory.createEmptyBorder());
	return jsp;
}
 
源代码2 项目: CQL   文件: AqlViewer.java
private <e, L> void apgInst0(JTabbedPane pane, ApgInstance<L, e> G) {
	List<JComponent> list = new LinkedList<>();

	Object[][] rowData;
	Object[] colNames;

	rowData = new Object[G.Es.size()][3];
	colNames = new Object[3];
	colNames[0] = "Element";
	colNames[1] = "Label";
	colNames[2] = "Value";
	int j = 0;
	for (Entry<e, Pair<L, ApgTerm<L, e>>> lt : G.Es.entrySet()) {
		rowData[j][0] = lt.getKey();
		rowData[j][1] = lt.getValue().first;
		rowData[j][2] = lt.getValue().second;
		j++;
	}
	list.add(GuiUtil.makeTable(BorderFactory.createEmptyBorder(), "Data", rowData, colNames));

	JPanel c = new JPanel();
	c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS));

	for (JComponent x : list) {
		x.setAlignmentX(Component.LEFT_ALIGNMENT);
		x.setMinimumSize(x.getPreferredSize());
		c.add(x);
	}

	JPanel p = new JPanel(new GridLayout(1, 1));
	p.add(c);
	JScrollPane jsp = new JScrollPane(p);

	c.setBorder(BorderFactory.createEmptyBorder());
	p.setBorder(BorderFactory.createEmptyBorder());
	jsp.setBorder(BorderFactory.createEmptyBorder());
	pane.addTab("Tables", p);
}
 
源代码3 项目: CQL   文件: AqlViewer.java
private <L> void apgSch0(JTabbedPane pane, ApgSchema<L> Ls) {
	List<JComponent> list = new LinkedList<>();

	Object[][] rowData = new Object[Ls.size()][2];
	Object[] colNames = new Object[2];
	colNames[0] = "Label";
	colNames[1] = "Type";
	int j = 0;
	for (Entry<L, ApgTy<L>> lt : Ls.entrySet()) {
		rowData[j][0] = lt.getKey();
		rowData[j][1] = lt.getValue();
		j++;
	}
	list.add(GuiUtil.makeTable(BorderFactory.createEmptyBorder(), "Schema", rowData, colNames));

	JPanel c = new JPanel();
	c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS));

	for (JComponent x : list) {
		x.setAlignmentX(Component.LEFT_ALIGNMENT);
		x.setMinimumSize(x.getPreferredSize());
		c.add(x);
	}

	JPanel p = new JPanel(new GridLayout(1, 1));
	p.add(c);
	JScrollPane jsp = new JScrollPane(p);

	c.setBorder(BorderFactory.createEmptyBorder());
	p.setBorder(BorderFactory.createEmptyBorder());
	jsp.setBorder(BorderFactory.createEmptyBorder());
	pane.addTab("Tables", p);
}
 
源代码4 项目: CQL   文件: GuiUtil.java
public static JComponent makeGrid(List<JComponent> list) {

		JPanel ret = new JPanel();
		ret.setLayout(new BoxLayout(ret, BoxLayout.PAGE_AXIS));
		// int i = 0;
		for (JComponent x : list) {
			x.setAlignmentX(Component.LEFT_ALIGNMENT);
			x.setMinimumSize(x.getPreferredSize());
			ret.add(x);
			// ret.add(Box.)
			// ret.add(Box.createHorizontalGlue());
		}
//		ret.add(new JLabel(""), Box.cre);

		JPanel p = new JPanel(new GridLayout(1, 1));

		p.add(ret);

		JScrollPane jsp = new JScrollPane(p);// , JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
												// JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

		ret.setBorder(BorderFactory.createEmptyBorder());
		p.setBorder(BorderFactory.createEmptyBorder());
		// jsp.setBorder(BorderFactory.createEmptyBorder());

		return jsp;
	}
 
源代码5 项目: ghidra   文件: FGSatelliteUndockedProvider.java
public FGSatelliteUndockedProvider(FunctionGraphPlugin plugin, FGController controller,
		JComponent satelliteComponent) {
	super(plugin.getTool(), NAME, plugin.getName());
	this.controller = controller;
	this.satelliteComponent = satelliteComponent;
	satelliteComponent.setMinimumSize(new Dimension(400, 400));

	setHelpLocation(new HelpLocation("FunctionGraphPlugin", "Satellite_View_Dock"));

	setIcon(ICON);
	setDefaultWindowPosition(WindowPosition.WINDOW);
	setWindowMenuGroup(FunctionGraphPlugin.FUNCTION_GRAPH_NAME);

	addToTool();
}
 
源代码6 项目: pumpernickel   文件: TextBlock.java
public JComponent createComponent() {
	JComponent jc = new JComponent() {
		@Override
		protected void paintComponent(Graphics g) {
			super.paintComponent(g);
			TextBlock.this.paint((Graphics2D) g);
		}
	};
	jc.setOpaque(false);
	jc.setMinimumSize(new Dimension(getWidth(), getHeight()));
	jc.setPreferredSize(new Dimension(getWidth(), getHeight()));
	return jc;
}
 
源代码7 项目: wpcleaner   文件: OnePageWindow.java
/**
 * Add a component for the Text.
 * 
 * @param panel Container.
 * @param constraints Constraints.
 * @param textPane Text pane.
 * @param undo Button undo.
 */
protected void addTextContents(
    JPanel panel, GridBagConstraints constraints,
    MWPane textPane, JButton undo) {
  if (textPane != null) {
    Configuration config = Configuration.getConfiguration();
    textPane.setBackground(Color.WHITE);
    textPane.setEditable(true);
    if (undo != null) {
      textPane.getUndoManager().setUndoLevels(config.getInt(
          null,
          ConfigurationValueInteger.ANALYSIS_UNDO_LVL));
    }
    textPane.addPropertyChangeListener(
        MWPane.PROPERTY_MODIFIED,
        new PropertyChangeListener() {

          /* (non-Javadoc)
           * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
           */
          @Override
          public void propertyChange(@SuppressWarnings("unused") PropertyChangeEvent evt) {
            updateComponentState();
          }
          
        });
    JComponent scrollContents = MWPane.createComplexPane(textPane);
    scrollContents.setMinimumSize(new Dimension(100, 100));
    scrollContents.setPreferredSize(new Dimension(1000, 500));
    panel.add(scrollContents, constraints);
  }
}
 
源代码8 项目: swift-explorer   文件: ErrorDlg.java
private JComponent setPrefSize (JComponent comp, int minPrefW, int minPrefH)
{
	if (comp == null)
		return null ;
	comp.setMinimumSize(new Dimension(200, 150));
	comp.setPreferredSize(new Dimension(minPrefW, minPrefH));
	comp.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
	return comp ;
}
 
private JComponent setPrefSize (JComponent comp, int minPrefW, int minPrefH)
{
	if (comp == null)
		return null ;
	comp.setMinimumSize(new Dimension(100, 100));
	comp.setPreferredSize(new Dimension(minPrefW, minPrefH));
	comp.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
	return comp ;
}
 
源代码10 项目: swift-explorer   文件: SwiftPanel.java
private JComponent setMinPrefMaxWidth (JComponent comp, int minPrefW, int maxW, int prefHeight)
{
	if (comp == null)
		return null ;
	comp.setMinimumSize(new Dimension(minPrefW, 0));
	comp.setPreferredSize(new Dimension(minPrefW, prefHeight));
	comp.setMaximumSize(new Dimension(maxW, Integer.MAX_VALUE));
	return comp ;
}
 
源代码11 项目: swift-explorer   文件: ProxyPanel.java
private JComponent setMinPrefMaxWidth (JComponent comp, int minPrefW, int maxW)
{
	if (comp == null)
		return null ;
	comp.setMinimumSize(new Dimension(minPrefW, 0));
	comp.setPreferredSize(new Dimension(minPrefW, 25));
	comp.setMaximumSize(new Dimension(maxW, Integer.MAX_VALUE));
	return comp ;
}
 
源代码12 项目: netbeans   文件: UI.java
public static void setSize(JComponent component, Dimension dimension) {
    component.setMinimumSize(dimension);
    component.setPreferredSize(dimension);
}
 
源代码13 项目: mzmine2   文件: MSMSLibrarySubmissionWindow.java
private void createSubmitParamPanel() {
  // Main panel which holds all the components in a grid
  pnSubmitParam = new GridBagPanel();
  pnSideMenu.add(pnSubmitParam, BorderLayout.NORTH);

  int rowCounter = 0;
  // Create labels and components for each parameter
  for (Parameter p : paramSubmit.getParameters()) {
    if (!(p instanceof UserParameter))
      continue;
    UserParameter up = (UserParameter) p;

    JComponent comp = up.createEditingComponent();
    comp.setToolTipText(up.getDescription());

    // Set the initial value
    Object value = up.getValue();
    if (value != null)
      up.setValueToComponent(comp, value);

    // By calling this we make sure the components will never be resized
    // smaller than their optimal size
    comp.setMinimumSize(comp.getPreferredSize());

    comp.setToolTipText(up.getDescription());


    // add separator
    if (p.getName().equals(LibrarySubmitParameters.LOCALFILE.getName())) {
      pnSubmitParam.addSeparator(0, rowCounter, 2);
      rowCounter++;
    }

    JLabel label = new JLabel(p.getName());
    pnSubmitParam.add(label, 0, rowCounter);
    label.setLabelFor(comp);

    parametersAndComponents.put(p.getName(), comp);

    JComboBox t = new JComboBox();
    int comboh = t.getPreferredSize().height;
    int comph = comp.getPreferredSize().height;


    int verticalWeight = comph > 2 * comboh ? 1 : 0;
    pnSubmitParam.add(comp, 1, rowCounter, 1, 1, 1, verticalWeight, GridBagConstraints.VERTICAL);
    rowCounter++;
  }
}
 
源代码14 项目: mzmine2   文件: MSMSLibrarySubmissionWindow.java
private void createMetaDataPanel() {
  // Main panel which holds all the components in a grid
  pnMetaData = new GridBagPanel();
  scrollMeta = new JScrollPane(pnMetaData);
  scrollMeta.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  scrollMeta.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  pnSideMenu.add(scrollMeta, BorderLayout.CENTER);

  int rowCounter = 0;
  int vertWeightSum = 0;

  // Create labels and components for each parameter
  for (Parameter p : paramMeta.getParameters()) {
    if (!(p instanceof UserParameter))
      continue;
    UserParameter up = (UserParameter) p;

    JComponent comp = up.createEditingComponent();
    comp.setToolTipText(up.getDescription());

    // Set the initial value
    Object value = up.getValue();
    if (value != null)
      up.setValueToComponent(comp, value);

    // By calling this we make sure the components will never be resized
    // smaller than their optimal size
    comp.setMinimumSize(comp.getPreferredSize());

    comp.setToolTipText(up.getDescription());

    JLabel label = new JLabel(p.getName());
    pnMetaData.add(label, 0, rowCounter);
    label.setLabelFor(comp);

    parametersAndComponents.put(p.getName(), comp);

    JComboBox t = new JComboBox();
    int comboh = t.getPreferredSize().height;
    int comph = comp.getPreferredSize().height;

    // Multiple selection will be expandable, other components not
    int verticalWeight = comph > 2 * comboh ? 1 : 0;
    vertWeightSum += verticalWeight;

    pnMetaData.add(comp, 1, rowCounter, 1, 1, 1, verticalWeight, GridBagConstraints.VERTICAL);
    rowCounter++;
  }
}
 
源代码15 项目: snap-desktop   文件: TimeRangeFilter.java
private void setJComponentSize(Dimension comboBoxDimension, JComponent comboBox) {
    comboBox.setPreferredSize(comboBoxDimension);
    comboBox.setMinimumSize(comboBoxDimension);
}