java.awt.FlowLayout#setVgap ( )源码实例Demo

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

源代码1 项目: sldeditor   文件: DataSourceConnectorRasterFile.java
/**
 * Creates the ui.
 */
private void createUI()
{
    dataSourceFieldPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) dataSourceFieldPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);

    JButton btnNewData = new JButton(Localisation.getString(DataSourceConnectorRasterFile.class, "DataSourceConnectorRasterFile.data"));
    dataSourceFieldPanel.add(btnNewData);

    dataSourceTextField = new JTextField();
    dataSourceFieldPanel.add(dataSourceTextField);
    dataSourceTextField.setColumns(50);

    btnNewData.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            chooseDataSourceToOpen();
        }
    });
}
 
源代码2 项目: sldeditor   文件: DataSourceConnectorShapeFile.java
/**
 * Creates the ui.
 */
private void createUI()
{
    dataSourceFieldPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) dataSourceFieldPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);

    JButton btnNewData = new JButton(Localisation.getString(DataSourceConnectorShapeFile.class, "DataSourceConnectorShapeFile.data"));
    dataSourceFieldPanel.add(btnNewData);

    dataSourceTextField = new JTextField();
    dataSourceFieldPanel.add(dataSourceTextField);
    dataSourceTextField.setColumns(50);

    btnNewData.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
        }
    });
}
 
源代码3 项目: sldeditor   文件: MapBoxTool.java
/** Creates the ui. */
private void createUI() {
    groupPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    TitledBorder titledBorder =
            BorderFactory.createTitledBorder(
                    Localisation.getString(MapBoxTool.class, "MapBoxTool.groupTitle"));
    groupPanel.setBorder(titledBorder);

    // Export to SLD
    exportToSLDButton =
            new ToolButton(
                    Localisation.getString(MapBoxTool.class, "MapBoxTool.exportToSLD"),
                    "tool/exporttosld.png");
    exportToSLDButton.setEnabled(false);
    exportToSLDButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    exportToSLD();
                }
            });
    groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
    groupPanel.add(exportToSLDButton);
}
 
源代码4 项目: mpxj   文件: JLabelledValue.java
/**
 * Constructor.
 *
 * @param label fixed label text
 */
public JLabelledValue(String label)
{
   FlowLayout flowLayout = (FlowLayout) getLayout();
   flowLayout.setAlignment(FlowLayout.LEFT);
   flowLayout.setVgap(0);
   flowLayout.setHgap(0);
   JLabel textLabel = new JLabel(label);
   textLabel.setFont(new Font("Tahoma", Font.BOLD, 11));
   textLabel.setPreferredSize(new Dimension(70, 14));
   add(textLabel);

   m_valueLabel = new JLabel("");
   m_valueLabel.setPreferredSize(new Dimension(80, 14));
   add(m_valueLabel);
}
 
源代码5 项目: ermasterr   文件: CompositeFactory.java
private static RowHeaderTable createRowHeaderTable(final Composite composite, final int width, final int height, final int rowHeaderWidth, final int rowHeight, final boolean iconEnable, final boolean editable) {
    final Frame frame = SWT_AWT.new_Frame(composite);
    final FlowLayout frameLayout = new FlowLayout();
    frameLayout.setVgap(0);
    frame.setLayout(frameLayout);

    final Panel panel = new Panel();
    final FlowLayout panelLayout = new FlowLayout();
    panelLayout.setVgap(0);
    panel.setLayout(panelLayout);
    frame.add(panel);

    final RowHeaderTable table = new RowHeaderTable(width, height, rowHeaderWidth, rowHeight, iconEnable, editable);
    panel.add(table);

    return table;
}
 
源代码6 项目: MtgDesktopCompanion   文件: TurnsPanel.java
public TurnsPanel() {
	FlowLayout flowLayout = (FlowLayout) getLayout();
	flowLayout.setVgap(1);
	flowLayout.setHgap(1);
	flowLayout.setAlignment(FlowLayout.LEFT);
	lblTurnNumber = new JLabel("Turn " + GameManager.getInstance().getTurns().size());
	add(lblTurnNumber);

	add(new JButton(new UntapPhase()));
	add(new JButton(new UpkeepPhase()));
	add(new JButton(new DrawPhase()));
	add(new JButton(new MainPhase(1)));
	add(new JButton(new CombatPhase()));
	add(new JButton(new AttackPhase()));
	add(new JButton(new BlockPhase()));
	add(new JButton(new DamagePhase()));
	add(new JButton(new EndCombatPhase()));
	add(new JButton(new MainPhase(2)));
	add(new JButton(new EndPhase()));
	add(new JButton(new CleanUpPhase()));
	add(new JButton(new EndTurnPhase()));
}
 
源代码7 项目: jplag   文件: JPlagCreator.java
public static JPanel createPanel(String title, int width, int height, int vGap, int hGap, int alignment, int type) {
	FlowLayout flowLayout1 = new FlowLayout();
	JPanel controlPanel = new JPanel();

	controlPanel.setLayout(flowLayout1);
	flowLayout1.setAlignment(alignment);
	controlPanel.setPreferredSize(new java.awt.Dimension(width, height));

	controlPanel.setBackground(JPlagCreator.SYSTEMCOLOR);
	if (type == WITH_LINEBORDER)
		controlPanel.setBorder(JPlagCreator.LINE);
	if (type == WITH_TITLEBORDER)
		controlPanel.setBorder(JPlagCreator.titleBorder(title, Color.BLACK, Color.BLACK));
	flowLayout1.setVgap(vGap);
	flowLayout1.setHgap(hGap);
	return controlPanel;
}
 
源代码8 项目: jplag   文件: JPlagCreator.java
/**
 * If width or height is not greater than 0, preferred size will not be set
 */
public static JPanel createPanel(int width, int height, int vGap, int hGap, int alignment) {
	FlowLayout flowLayout1 = new FlowLayout();
	JPanel controlPanel = new JPanel();

	controlPanel.setLayout(flowLayout1);
	flowLayout1.setAlignment(alignment);
	if (width > 0 && height > 0)
		controlPanel.setPreferredSize(new java.awt.Dimension(width, height));

	controlPanel.setBackground(JPlagCreator.SYSTEMCOLOR);
	controlPanel.setBorder(JPlagCreator.LINE);
	flowLayout1.setVgap(vGap);
	flowLayout1.setHgap(hGap);
	return controlPanel;
}
 
源代码9 项目: DroidUIBuilder   文件: Desing$CodeSwitcherPane.java
public BtnPane()
{
	FlowLayout btnPaneLayout = new FlowLayout(FlowLayout.CENTER);
	btnPaneLayout.setHgap(0);
	btnPaneLayout.setVgap(0);
	this.setLayout(btnPaneLayout);
	this.setPreferredSize(new Dimension(129,25));
}
 
源代码10 项目: netbeans   文件: StatusLineComponent.java
public StatusLineComponent() {
        handleComponentMap = new HashMap<InternalHandle, ListComponent>();
        FlowLayout flay = new FlowLayout();
        flay.setVgap(1);
        flay.setHgap(5);
        setLayout(flay);
        mouseListener = new MListener();
        addMouseListener(mouseListener);
        hideListener = new HideAWTListener();
        
        createLabel();
        createBar();
        // tricks to figure out correct height.
        bar.setStringPainted(true);
        bar.setString("@@@"); // NOI18N
        label.setText("@@@"); // NOI18N
        preferredHeight = Math.max(label.getPreferredSize().height, bar.getPreferredSize().height) + 3;
        setOpaque(false);
        discardLabel();
        discardBar();
        
        pane = new PopupPane();
        pane.getActionMap().put("HidePopup", new AbstractAction() {
            public @Override void actionPerformed(ActionEvent actionEvent) {
//                System.out.println("escape pressed - hiding");
                hidePopup();
            }
        });
        pane.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "HidePopup");
        pane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "HidePopup");
        
        
    }
 
源代码11 项目: gate-core   文件: JChoice.java
/**
 * Creates a FastChoice with the given data model.
 */
public JChoice(ComboBoxModel<E> model) {
  layout = new FlowLayout();
  layout.setHgap(0);
  layout.setVgap(0);
  layout.setAlignment(FlowLayout.LEFT);
  setLayout(layout);
  this.model = model;
  //by default nothing is selected
  setSelectedItem(null);
  initLocalData();
  buildGui();
}
 
源代码12 项目: sldeditor   文件: BatchUpdateFontTool.java
/** Creates the ui. */
private void createUI() {
    panel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    panel.setBorder(
            BorderFactory.createTitledBorder(
                    Localisation.getString(
                            BatchUpdateFontTool.class, "BatchUpdateFontTool.title")));

    toolButton =
            new ToolButton(
                    Localisation.getString(
                            BatchUpdateFontTool.class, "BatchUpdateFontTool.title"),
                    "tool/batchupdatefont.png");
    panel.add(toolButton);
    toolButton.setEnabled(false);
    toolButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    BatchUpdateFontPanel scalePanel = new BatchUpdateFontPanel(application);

                    scalePanel.populate(sldDataList);
                    scalePanel.setVisible(true);
                }
            });
    panel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}
 
源代码13 项目: sldeditor   文件: ToolPanel.java
/**
 * Instantiates a new tool panel.
 *
 * @param parentObj the parent obj
 * @param toolMap the tool map
 */
public ToolPanel(ToolSelectionInterface parentObj, Map<Class<?>, List<ToolInterface>> toolMap) {
    this.toolSelection = parentObj;

    theToolPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) theToolPanel.getLayout();
    flowLayout.setAlignOnBaseline(true);
    flowLayout.setVgap(1);
    flowLayout.setHgap(1);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    this.add(theToolPanel);

    this.toolMap = toolMap;

    JPanel optionsPanel = new JPanel();
    add(optionsPanel);

    JCheckBox chckbxRecursive =
            new JCheckBox(Localisation.getString(ToolPanel.class, "ToolPanel.recursive"));
    chckbxRecursive.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    toolSelection.setRecursiveFlag(chckbxRecursive.isSelected());
                }
            });
    optionsPanel.add(chckbxRecursive);
    this.setPreferredSize(new Dimension(50, EMPTY_TOOL_PANEL_HEIGHT));
}
 
源代码14 项目: DroidUIBuilder   文件: SwitchablePane.java
/**
	 * 核心GUI初始化方法.
	 * 
	 * @param cards
	 */
	protected void initGUI(Object[][] cards)
	{
		// 实例化子各主要面板
		mainPane = new JPanel(new BorderLayout());
		cardPane = new JPanel(new CardLayout());
		FlowLayout btnPaneLayout = new FlowLayout(FlowLayout.CENTER);
		btnPaneLayout.setVgap(0);
		btnPane = new JPanel(btnPaneLayout);
		
		// 加入向前按钮
		addToBtnPane(initPreviousButton());
		// 加入页号按钮
		for(int i=0;i<cards.length;i++ )
		{
			Object[] cardInfo = cards[i];
//			String num = (String)cardInfo[0];
			JComponent c = (JComponent)cardInfo[0];
			String toolTipText = (String)cardInfo[1];
			
			// 此key即进分页组件的顺序号(从1开始),又将做为它
			// 位于CardLayout中的name(constraints),一举多得
			final String key = (i+1)+"";
			// 先在把要显示的内容组件加入到内容子面板中
			this.addCard(key, c, toolTipText);
			// 再把该分页内容组件对应的页号按钮加入到按钮面板中
			addToBtnPane(createPageButton(key, toolTipText));
		}
		// 加入向后按钮
		addToBtnPane(initNextButton());
		
		// 总体布局
		mainPane.add(cardPane, BorderLayout.CENTER);
		mainPane.add(btnPane, BorderLayout.SOUTH);
	}
 
源代码15 项目: sldeditor   文件: StickyDataSourceTool.java
/** Creates the UI. */
private void createUI() {
    groupPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    groupPanel.setBorder(
            BorderFactory.createTitledBorder(
                    Localisation.getString(
                            StickyDataSourceTool.class, "StickyDataSourceTool.groupTitle")));

    // Export to YSLD
    stickyButton =
            new ToggleToolButton(
                    Localisation.getString(
                            StickyDataSourceTool.class, "StickyDataSourceTool.dataSource"),
                    "tool/stickydatasource.png");
    stickyButton.setEnabled(true);
    final StickyDataSourceTool callingObj = this;

    stickyButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    SLDEditorFile.getInstance()
                            .setStickyDataSource(callingObj, stickyButton.isSelected());
                }
            });

    groupPanel.add(stickyButton);
    groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}
 
源代码16 项目: DroidUIBuilder   文件: Desing$CodeSwitcherPane.java
private void initGUI()
{
	// 实例化按钮
	ButtonGroup bg = new ButtonGroup();
	btnLeft = new JToggleButton("");
	btnRight = new JToggleButton("");
	btnLeft.setContentAreaFilled(false);
	btnLeft.setFocusable(false);
	btnLeft.setBorder(null);
	btnLeft.setPreferredSize(new Dimension(64,25));
	btnRight.setContentAreaFilled(false);
	btnRight.setFocusable(false);
	btnRight.setBorder(null);
	btnRight.setPreferredSize(new Dimension(64,25));
	
	// 加入到ButtonGroup(实现RadioButton的形为)
	bg.add(btnLeft);
	bg.add(btnRight);
	
	// 主面板布局
	FlowLayout mainLayout = new FlowLayout(FlowLayout.CENTER);
	mainLayout.setHgap(0);
	mainLayout.setVgap(2);
	this.setLayout(mainLayout);
	// 此处的border的设置是为了背景上部的装饰而做哦
	this.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
	
	// 实例化按钮面板
	btnPane = new BtnPane();
	btnPane.add(btnLeft);
	btnPane.add(btnRight);
	
	// 添加到总体布局中
	this.add(btnPane);
}
 
源代码17 项目: CQL   文件: Option.java
/**
 * Creates a new label/component pair. If given multiple compnents, will add
 * them to a JPanel and then set that as the component. Note that this is better
 * than putting them into a JPanel yourself: the label will be centered on the
 * first component passed-in.
 *
 * @param label      the JLabel of the option
 * @param components
 */
public Option(JLabel label, JComponent... components) {
	setLabel(label);

	if (components.length > 1) {
		JPanel panel = new JPanel();
		FlowLayout flow = (FlowLayout) panel.getLayout();

		flow.setAlignment(FlowLayout.LEFT);
		flow.setVgap(0);
		flow.setHgap(0);

		for (JComponent jc : components) {
			panel.add(jc);
		}

		JUtils.fixHeight(panel);
		setComponent(panel);
	} else {
		setComponent((components.length > 0) ? components[0] : null);
	}

	// We try to align the label with the first component (descending into
	// JPanels), by creating a border that aligns the middle of the border
	// with the middle of the first component.
	if (components.length > 0) {
		int labelOffset = -label.getPreferredSize().height;
		Component comp = components[0];

		while (comp instanceof JPanel) {
			labelOffset += 2 * (((JPanel) comp).getInsets().top);
			comp = ((JPanel) comp).getComponent(0);
		}

		if (comp != null) {
			labelOffset += comp.getPreferredSize().height;

			if (labelOffset > 0) { // Only do it if the first non-JPanel
									// component is bigger
				label.setBorder(new EmptyBorder(labelOffset / 2, 0, 0, 0));
			}
		}
	}
}
 
源代码18 项目: sldeditor   文件: SaveSLDTool.java
/** Creates the ui. */
private void createUI() {
    groupPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    groupPanel.setBorder(
            BorderFactory.createTitledBorder(
                    Localisation.getString(SaveSLDTool.class, "SaveSLDTool.save")));

    saveAllSLD =
            new ToolButton(
                    Localisation.getString(SaveSLDTool.class, "SaveSLDTool.sld"),
                    "tool/savesld.png");
    saveAllSLD.setEnabled(false);
    saveAllSLD.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    JFileChooser chooser = new JFileChooser();
                    chooser.setCurrentDirectory(new java.io.File("."));
                    chooser.setDialogTitle(
                            Localisation.getString(
                                    SaveSLDTool.class, "SaveSLDTool.destinationFolder"));
                    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

                    //
                    // Disable the "All files" option.
                    //
                    chooser.setAcceptAllFileFilterUsed(false);

                    // Save external images option
                    JPanel accessory = new JPanel();
                    JCheckBox isOpenBox =
                            new JCheckBox(
                                    Localisation.getString(
                                            SaveSLDTool.class,
                                            "SaveSLDTool.saveExternalImages"));
                    accessory.setLayout(new BorderLayout());
                    accessory.add(isOpenBox, BorderLayout.CENTER);
                    chooser.setAccessory(accessory);

                    if (chooser.showSaveDialog(saveAllSLD) == JFileChooser.APPROVE_OPTION) {

                        worker.saveAllSLDToFolder(
                                sldDataList, chooser.getSelectedFile(), isOpenBox.isSelected());
                    }
                }
            });

    groupPanel.add(saveAllSLD);
    saveAllSLD.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}
 
public MagicEditionJLabelRenderer() {
	FlowLayout flowLayout = new FlowLayout();
	flowLayout.setVgap(0);
	flowLayout.setAlignment(FlowLayout.LEFT);
	pane.setLayout(flowLayout);
}
 
源代码20 项目: mzmine2   文件: MultiSpectraVisualizerWindow.java
public MultiSpectraVisualizerWindow(PeakListRow row, RawDataFile raw) {
  setBackground(Color.WHITE);
  setExtendedState(JFrame.MAXIMIZED_BOTH);
  setMinimumSize(new Dimension(800, 600));
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  getContentPane().setLayout(new BorderLayout());

  pnGrid = new JPanel();
  // any number of rows
  pnGrid.setLayout(new GridLayout(0, 1, 0, 25));
  pnGrid.setAutoscrolls(true);

  JScrollPane scrollPane = new JScrollPane(pnGrid);
  scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
  getContentPane().add(scrollPane, BorderLayout.CENTER);

  JPanel pnMenu = new JPanel();
  FlowLayout fl_pnMenu = (FlowLayout) pnMenu.getLayout();
  fl_pnMenu.setVgap(0);
  fl_pnMenu.setAlignment(FlowLayout.LEFT);
  getContentPane().add(pnMenu, BorderLayout.NORTH);

  JButton nextRaw = new JButton("next");
  nextRaw.addActionListener(e -> nextRaw());
  JButton prevRaw = new JButton("prev");
  prevRaw.addActionListener(e -> prevRaw());
  pnMenu.add(prevRaw);
  pnMenu.add(nextRaw);

  lbRaw = new JLabel();
  pnMenu.add(lbRaw);

  JLabel lbRawTotalWithFragmentation = new JLabel();
  pnMenu.add(lbRaw);

  int n = 0;
  for (Feature f : row.getPeaks()) {
    if (f.getMostIntenseFragmentScanNumber() > 0)
      n++;
  }
  lbRawTotalWithFragmentation.setText("(total raw:" + n + ")");

  // add charts
  setData(row, raw);

  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  setVisible(true);
  validate();
  repaint();
  pack();
}