当前位置: 首页>>代码示例>>Java>>正文


Java JPanel.setAlignmentY方法代码示例

本文整理汇总了Java中javax.swing.JPanel.setAlignmentY方法的典型用法代码示例。如果您正苦于以下问题:Java JPanel.setAlignmentY方法的具体用法?Java JPanel.setAlignmentY怎么用?Java JPanel.setAlignmentY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JPanel的用法示例。


在下文中一共展示了JPanel.setAlignmentY方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTo

import javax.swing.JPanel; //导入方法依赖的package包/类
public void addTo(Buildable b) {
  //Create the turn window
  turnWindow = new TurnWindow();
  turnWindow.pack();
  turnWindow.setVisible(false);

  launchWidget = new JPanel();
  launchWidget.setLayout(new BorderLayout());
  launchWidget.setBorder(BorderFactory.createEtchedBorder());
  GameModule.getGameModule().getToolBar().add(launchWidget);
  launchWidget.setAlignmentY(0.0F);
  launchWidget.setVisible(false);

  GameModule.getGameModule().getToolBar().add(launch);
  launch.setAlignmentY(0.0F);
  launch.setEnabled(false);

  setDocked(isDocked());

  GameModule.getGameModule().addCommandEncoder(this);
  GameModule.getGameModule().getGameState().addGameComponent(this);
  idMgr.add(this);

  //Global Property support
  lastCommand.addTo((MutablePropertiesContainer) b);
  lastTurn.addTo((MutablePropertiesContainer) b);

}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:29,代码来源:TurnTracker.java

示例2: addDivider

import javax.swing.JPanel; //导入方法依赖的package包/类
/** Add a vertical divider to the toolbar. */
private void addDivider() {
	JPanel divider = OurUtil.makeH(new Dimension(1, 40), Color.LIGHT_GRAY);
	divider.setAlignmentY(0.5f);
	if (!Util.onMac())
		toolbar.add(OurUtil.makeH(5, background));
	else
		toolbar.add(OurUtil.makeH(5));
	toolbar.add(divider);
	if (!Util.onMac())
		toolbar.add(OurUtil.makeH(5, background));
	else
		toolbar.add(OurUtil.makeH(5));
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:15,代码来源:VizGUI.java

示例3: addDivider

import javax.swing.JPanel; //导入方法依赖的package包/类
/** Add a vertical divider to the toolbar. */
private void addDivider() {
   JPanel divider = OurUtil.makeH(new Dimension(1, 40), Color.LIGHT_GRAY);
   divider.setAlignmentY(0.5f);
   if (!Util.onMac()) toolbar.add(OurUtil.makeH(5,background)); else toolbar.add(OurUtil.makeH(5));
   toolbar.add(divider);
   if (!Util.onMac()) toolbar.add(OurUtil.makeH(5,background)); else toolbar.add(OurUtil.makeH(5));
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:9,代码来源:VizGUI.java

示例4: newtab

import javax.swing.JPanel; //导入方法依赖的package包/类
/** Create a new tab with the given filename (if filename==null, we'll create a blank tab instead)
 * <p> If a text buffer with that filename already exists, we will just switch to it; else we'll read that file into a new tab.
 * @return false iff an error occurred
 */
public boolean newtab(String filename) {
   if (filename!=null) {
      filename = Util.canon(filename);
      for(int i=0; i<tabs.size(); i++) if (tabs.get(i).getFilename().equals(filename)) { if (i!=me) select(i); return true; }
   }
   final JLabel lb = OurUtil.label("", OurUtil.getVizFont().deriveFont(Font.BOLD), Color.BLACK, Color.WHITE);
   lb.setBorder(new OurBorder(BORDER, BORDER, Color.WHITE, BORDER));
   lb.addMouseListener(new MouseAdapter() {
      @Override public void mousePressed(MouseEvent e) { for(int i=0; i<tabs.size(); i++) if (tabs.get(i).obj1 == lb) select(i); }
   });
   JPanel h1 = OurUtil.makeH(4); h1.setBorder(new OurBorder(null, null, BORDER, null));
   JPanel h2 = OurUtil.makeH(3); h2.setBorder(new OurBorder(null, null, BORDER, null));
   JPanel pan = Util.onMac() ? OurUtil.makeVL(null, 2, OurUtil.makeHB(h1, lb, h2))
                             : OurUtil.makeVL(null, 2, OurUtil.makeHB(h1, lb, h2, GRAY), GRAY);
   pan.setAlignmentX(0.0f);
   pan.setAlignmentY(1.0f);
   OurSyntaxWidget text = new OurSyntaxWidget(syntaxHighlighting, "", fontName, fontSize, tabSize, lb, pan);
   tabBar.add(pan, tabs.size());
   tabs.add(text);
   text.listeners.add(listener); // add listener AFTER we've updated this.tabs and this.tabBar
   if (filename==null) {
      text.discard(false, getFilenames()); // forces the tab to re-derive a suitable fresh name
   } else {
      if (!text.load(filename)) return false;
      for(int i=tabs.size()-1; i>=0; i--) if (!tabs.get(i).isFile() && tabs.get(i).getText().length()==0) {
         tabs.get(i).discard(false, getFilenames()); close(i); break; // Remove the rightmost untitled empty tab
      }
   }
   select(tabs.size() - 1); // Must call this to switch to the new tab; and it will fire STATUS_CHANGE message which is important
   return true;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:36,代码来源:OurTabbedSyntaxWidget.java

示例5: createHorizontalPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
public JPanel createHorizontalPanel(boolean threeD) 
{
	JPanel p = new JPanel();
	p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
	p.setAlignmentY(TOP_ALIGNMENT);
	p.setAlignmentX(LEFT_ALIGNMENT);
	if(threeD) 
	{
		p.setBorder(loweredBorder);
	}
	return p;
}
 
开发者ID:HML-UnBBayes,项目名称:hml,代码行数:13,代码来源:MyPanel.java

示例6: createVerticalPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
public JPanel createVerticalPanel(boolean threeD) 
{
	JPanel p = new JPanel();
	p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
	p.setAlignmentY(TOP_ALIGNMENT);
	p.setAlignmentX(LEFT_ALIGNMENT);
	if(threeD) 
	{
		p.setBorder(loweredBorder);
	}
	return p;
}
 
开发者ID:HML-UnBBayes,项目名称:hml,代码行数:13,代码来源:MyPanel.java

示例7: ParametersPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
public ParametersPanel() {
    messageLabel.setLabelFor(messageTextArea);
    Mnemonics.setLocalizedText(messageLabel, getMessage("CTL_CommitForm_Message")); // NOI18N

    JLabel templateLink = getMessagesTemplateLink(messageTextArea, "org.netbeans.modules.versioning.util.common.TemplatePanel"); //NOI18N
    JLabel recentLink = getRecentMessagesLink(messageTextArea);

    messageTextArea.setColumns(60);    //this determines the preferred width of the whole dialog
    messageTextArea.setLineWrap(true);
    messageTextArea.setRows(4);
    messageTextArea.setTabSize(4);
    messageTextArea.setWrapStyleWord(true);
    messageTextArea.setMinimumSize(new Dimension(100, 18));
    scrollpane.setViewportView(messageTextArea);

    messageTextArea.getAccessibleContext().setAccessibleName(getMessage("ACSN_CommitForm_Message")); // NOI18N
    messageTextArea.getAccessibleContext().setAccessibleDescription(getMessage("ACSD_CommitForm_Message")); // NOI18N
    if(commitMessage != null) {
        messageTextArea.setText(commitMessage);
    }
    
    JPanel topPanel = new VerticallyNonResizingPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
    topPanel.add(messageLabel);
    topPanel.add(Box.createHorizontalGlue());
    topPanel.add(recentLink);
    topPanel.add(makeHorizontalStrut(recentLink, templateLink, RELATED, this));
    topPanel.add(templateLink);            
    messageLabel.setAlignmentX(LEFT_ALIGNMENT);
    messageLabel.setAlignmentY(BOTTOM_ALIGNMENT); 
    recentLink.setAlignmentY(BOTTOM_ALIGNMENT);
    templateLink.setAlignmentY(BOTTOM_ALIGNMENT);        

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    topPanel.setAlignmentY(BOTTOM_ALIGNMENT);        
    add(topPanel);
    add(makeVerticalStrut(messageLabel, scrollpane, RELATED, this));            
    add(scrollpane);
    
    Spellchecker.register (messageTextArea);    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:VCSCommitParameters.java

示例8: initComponents

import javax.swing.JPanel; //导入方法依赖的package包/类
private void initComponents() {
	this.setBorder(new EmptyBorder(5, 5, 5, 5));
	this.setLayout(new BorderLayout(5, 5));
	infiniteQueueSelector = new JRadioButton("infinite");
	finiteQueueSelector = new JRadioButton("finite");
	queueLengthGroup = new ButtonGroup();
	queueLengthGroup.add(infiniteQueueSelector);
	queueLengthGroup.add(finiteQueueSelector);
	queueLengthSpinner = new JSpinner();
	queueLengthSpinner.setValue(new Integer(1));
	queueLengthSpinner.setPreferredSize(DIM_BUTTON_XS);
	queueTable = new QueueTable();

	//queue details panel
	JPanel queuePolicyPanel = new JPanel(new BorderLayout());
	queuePolicyPanel.setBorder(new TitledBorder(new EtchedBorder(), "Queue Policy"));
	queuePolicyPanel.add(new WarningScrollTable(queueTable, WARNING_CLASS), BorderLayout.CENTER);
	JPanel queueLengthPanel = new JPanel(new GridLayout(3, 1, 3, 3));
	queueLengthPanel.setBorder(new TitledBorder(new EtchedBorder(), "Capacity"));

	// Queue strategy selector
	JPanel queueStrategy = new JPanel(new BorderLayout());
	queueStrategy.add(new JLabel("Station queue policy: "), BorderLayout.WEST);
	queuePolicyCombo = new JComboBox();
	queueStrategy.add(queuePolicyCombo, BorderLayout.CENTER);
	queuePolicyPanel.add(queueStrategy, BorderLayout.NORTH);
	queueStrategy.setBorder(BorderFactory.createEmptyBorder(2, 5, 10, 5));

	queueLengthPanel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
	queueLengthPanel.add(infiniteQueueSelector);
	queueLengthPanel.add(finiteQueueSelector);
	JPanel spinnerPanel = new JPanel();
	new BoxLayout(spinnerPanel, BoxLayout.Y_AXIS);
	JLabel label = new JLabel("max num.customers: ");
	label.setToolTipText("The maximum number of customers allowed in the station.");
	spinnerPanel.add(label);
	spinnerPanel.add(queueLengthSpinner);
	queueLengthPanel.add(spinnerPanel);

	this.add(queueLengthPanel, BorderLayout.WEST);
	this.add(queuePolicyPanel, BorderLayout.CENTER);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:43,代码来源:InputSectionPanel.java

示例9: newtab

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Create a new tab with the given filename (if filename==null, we'll create
 * a blank tab instead)
 * <p>
 * If a text buffer with that filename already exists, we will just switch
 * to it; else we'll read that file into a new tab.
 * 
 * @return false iff an error occurred
 */
public boolean newtab(String filename) {
	if (filename != null) {
		filename = Util.canon(filename);
		for (int i = 0; i < tabs.size(); i++)
			if (tabs.get(i).getFilename().equals(filename)) {
				if (i != me)
					select(i);
				return true;
			}
	}
	final JLabel lb = OurUtil.label("", OurUtil.getVizFont().deriveFont(Font.BOLD), Color.BLACK, Color.WHITE);
	lb.setBorder(new OurBorder(BORDER, BORDER, Color.WHITE, BORDER));
	lb.addMouseListener(new MouseAdapter() {
		@Override
		public void mousePressed(MouseEvent e) {
			for (int i = 0; i < tabs.size(); i++)
				if (tabs.get(i).obj1 == lb)
					select(i);
		}
	});
	JPanel h1 = OurUtil.makeH(4);
	h1.setBorder(new OurBorder(null, null, BORDER, null));
	JPanel h2 = OurUtil.makeH(3);
	h2.setBorder(new OurBorder(null, null, BORDER, null));
	JPanel pan = Util.onMac() ? OurUtil.makeVL(null, 2, OurUtil.makeHB(h1, lb, h2))
			: OurUtil.makeVL(null, 2, OurUtil.makeHB(h1, lb, h2, GRAY), GRAY);
	pan.setAlignmentX(0.0f);
	pan.setAlignmentY(1.0f);
	OurSyntaxWidget text = new OurSyntaxWidget(syntaxHighlighting, "", fontName, fontSize, tabSize, lb, pan);
	tabBar.add(pan, tabs.size());
	tabs.add(text);
	text.listeners.add(listener); // add listener AFTER we've updated
									// this.tabs and this.tabBar
	if (filename == null) {
		text.discard(false, getFilenames()); // forces the tab to re-derive
												// a suitable fresh name
	} else {
		if (!text.load(filename))
			return false;
		for (int i = tabs.size() - 1; i >= 0; i--)
			if (!tabs.get(i).isFile() && tabs.get(i).getText().length() == 0) {
				tabs.get(i).discard(false, getFilenames());
				close(i);
				break; // Remove the rightmost untitled empty tab
			}
	}
	select(tabs.size() - 1); // Must call this to switch to the new tab; and
								// it will fire STATUS_CHANGE message which
								// is important
	return true;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:61,代码来源:OurTabbedSyntaxWidget.java


注:本文中的javax.swing.JPanel.setAlignmentY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。