本文整理匯總了Java中javax.swing.JComponent.setAlignmentX方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.setAlignmentX方法的具體用法?Java JComponent.setAlignmentX怎麽用?Java JComponent.setAlignmentX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.setAlignmentX方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildPanel
import javax.swing.JComponent; //導入方法依賴的package包/類
/** builds the panel of pots */
private void buildPanel() {
IPotSliderTextControl.allInstances.clear();
potList=new ArrayList<Pot>(pots.getPots());
componentList=new ArrayList<JComponent>();
Collections.sort(potList, new PotDisplayComparator());
potsPanel=new JPanel();
potsPanel.setAlignmentX(RIGHT_ALIGNMENT);
potsPanel.getInsets().set(0, 0, 0, 0);
potsPanel.setLayout(new BoxLayout(potsPanel, BoxLayout.Y_AXIS));
scrollPane=new JScrollPane(potsPanel);
add(new PotSorter(componentList, potList));
add(scrollPane);
for(Pot p : potList) {
JComponent s=p.makeGUIPotControl(); // make a bias control gui component
s.setAlignmentX(RIGHT_ALIGNMENT);
potsPanel.add(s);
componentList.add(s);
addBorderSetter(s);
}
potsPanel.add(Box.createVerticalGlue());
// JPanel fillPanel=new JPanel();
// fillPanel.setMinimumSize(new Dimension(0, 0));
// fillPanel.setPreferredSize(new Dimension(0, 0));
// fillPanel.setMaximumSize(new Dimension(32767, 32767));
// potsPanel.add(fillPanel); // spacer at bottom so biases don't stretch out too much
}
示例2: FilesPanel
import javax.swing.JComponent; //導入方法依賴的package包/類
public FilesPanel(VCSCommitPanel master, Map<String, VCSCommitFilter> filters, int preferedHeight) {
super(master, master.getModifier().getMessage(VCSCommitPanelModifier.BundleMessage.FILE_PANEL_TITLE), DEFAULT_DISPLAY_FILES);
this.filters = filters;
master.getCommitTable().labelFor(filesLabel);
JComponent table = master.getCommitTable().getComponent();
Mnemonics.setLocalizedText(filesLabel, getMessage("CTL_CommitForm_FilesToCommit")); // NOI18N
filesLabel.setMaximumSize(new Dimension(Integer.MAX_VALUE, filesLabel.getMaximumSize().height));
table.setPreferredSize(new Dimension(0, preferedHeight));
ButtonGroup bg = new ButtonGroup();
toolbar = new JToolBar();
toolbar.setFloatable(false);
for (VCSCommitFilter filter : filters.values()) {
JToggleButton tgb = new JToggleButton();
tgb.setIcon(filter.getIcon());
tgb.setToolTipText(filter.getTooltip());
tgb.setFocusable(false);
tgb.setSelected(filter.isSelected());
tgb.addActionListener(this);
tgb.putClientProperty(TOOLBAR_FILTER, filter);
bg.add(tgb);
toolbar.add(tgb);
}
toolbar.setAlignmentX(LEFT_ALIGNMENT);
sectionPanel.add(toolbar);
sectionPanel.add(table);
sectionPanel.add(VCSCommitPanel.makeVerticalStrut(filesLabel, table, RELATED, sectionPanel));
sectionPanel.add(filesLabel);
sectionPanel.setAlignmentX(LEFT_ALIGNMENT);
filesLabel.setAlignmentX(LEFT_ALIGNMENT);
table.setAlignmentX(LEFT_ALIGNMENT);
}
示例3: createVisualComp
import javax.swing.JComponent; //導入方法依賴的package包/類
private Component createVisualComp() {
JCheckBox[] chkBoxes;
JComponent infoLabel = GuiUtils.createMultilineLabel(
NbBundle.getMessage(TestSuiteStepLocation.class,
"TXT_ClassesInSuite")); //NOI18N
JComponent optCode = GuiUtils.createChkBoxGroup(
NbBundle.getMessage(
GuiUtils.class,
"CommonTestsCfgOfCreate.groupOptCode"), //NOI18N
chkBoxes = GuiUtils.createCheckBoxes(new String[] {
GuiUtils.CHK_SETUP,
GuiUtils.CHK_TEARDOWN,
GuiUtils.CHK_BEFORE_CLASS,
GuiUtils.CHK_AFTER_CLASS}));
chkSetUp = chkBoxes[0];
chkTearDown = chkBoxes[1];
chkBeforeClass = chkBoxes[2];
chkAfterClass = chkBoxes[3];
JComponent optComments = GuiUtils.createChkBoxGroup(
NbBundle.getMessage(
GuiUtils.class,
"CommonTestsCfgOfCreate.groupOptComments"), //NOI18N
chkBoxes = GuiUtils.createCheckBoxes(new String[] {
GuiUtils.CHK_HINTS}));
chkCodeHints = chkBoxes[0];
JComponent bottomPanel = new SelfResizingPanel();
bottomPanel.setLayout(new BorderLayout(0, 24));
bottomPanel.add(infoLabel, BorderLayout.NORTH);
JComponent box = new JPanel();
box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS));
box.add(optCode);
box.add(Box.createHorizontalStrut(18));
box.add(optComments);
bottomPanel.add(box, BorderLayout.CENTER);
/* tune layout of the components within the box: */
infoLabel.setAlignmentX(0.0f);
optCode.setAlignmentY(0.0f);
optComments.setAlignmentY(0.0f);
return bottomPanel;
}
示例4: alignComponent
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* align the component to the left side of the panel
* @param comp
*/
void alignComponent(JComponent comp) {
comp.setAlignmentX(Component.LEFT_ALIGNMENT);
comp.setPreferredSize(compDim);
comp.setMaximumSize(compDim);
}
示例5: alignComponent
import javax.swing.JComponent; //導入方法依賴的package包/類
void alignComponent(JComponent comp) {
comp.setAlignmentX(Component.LEFT_ALIGNMENT);
comp.setPreferredSize(compDim);
comp.setMaximumSize(compDim);
}