本文整理匯總了Java中javax.swing.JPanel.setAlignmentX方法的典型用法代碼示例。如果您正苦於以下問題:Java JPanel.setAlignmentX方法的具體用法?Java JPanel.setAlignmentX怎麽用?Java JPanel.setAlignmentX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JPanel
的用法示例。
在下文中一共展示了JPanel.setAlignmentX方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: create2ColPane
import javax.swing.JPanel; //導入方法依賴的package包/類
/**
* Like createPane, but creates a pane with 2 columns of radio buttons. The
* number of buttons passed in *must* be even.
*/
private JPanel create2ColPane(String description, JRadioButton[] radioButtons, JButton showButton) {
JLabel label = new JLabel(description);
int numPerColumn = radioButtons.length / 2;
JPanel grid = new JPanel(new GridLayout(0, 2));
for (int i = 0; i < numPerColumn; i++) {
grid.add(radioButtons[i]);
grid.add(radioButtons[i + numPerColumn]);
}
JPanel box = new JPanel();
box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
box.add(label);
grid.setAlignmentX(0.0f);
box.add(grid);
JPanel pane = new JPanel(new BorderLayout());
pane.add(box, BorderLayout.PAGE_START);
pane.add(showButton, BorderLayout.PAGE_END);
return pane;
}
示例2: initComponents
import javax.swing.JPanel; //導入方法依賴的package包/類
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
private void initComponents() {
setToolTipText("Select a tab to configure an aspect of the device.");
onchipBiasgenPanel = new JPanel();
onchipBiasgenPanel.setLayout(new BoxLayout(onchipBiasgenPanel, BoxLayout.Y_AXIS));
onchipBiasgenPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
addTab("On-chip biases (biasgen)", (onchipBiasgenPanel));
offchipDACPanel = new JPanel();
offchipDACPanel.setLayout(new BoxLayout(offchipDACPanel, BoxLayout.Y_AXIS));
addTab("Off-chip biases (DAC)", (offchipDACPanel));
aerPanel = new JPanel();
aerPanel.setLayout(new BoxLayout(aerPanel, BoxLayout.Y_AXIS));
addTab("AER Config", (aerPanel));
chipDiagPanel = new JPanel();
chipDiagPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
chipDiagPanel.setLayout(new BoxLayout(chipDiagPanel, BoxLayout.Y_AXIS));
addTab("Chip Diag Config", (chipDiagPanel));
}
示例3: buildSeparator
import javax.swing.JPanel; //導入方法依賴的package包/類
/**
* Builds a separator for the node parâmetros
*
* @return JComponent
*/
private JComponent buildSeparator() {
JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
separator.setBorder(new EmptyBorder(0, 0, 0, 25));
separator.setForeground(new Color(0xAAAAAA));
separator.setBackground(new Color(0xAAAAAA));
JPanel container = new JPanel(new BorderLayout());
container.setBorder(new EmptyBorder(0, 10, 0, 10));
container.add(separator);
container.setAlignmentX(JLabel.LEFT_ALIGNMENT);
container.setOpaque(false);
return container;
}
示例4: buildLabel
import javax.swing.JPanel; //導入方法依賴的package包/類
/**
* Build the label for the parameter
*
* @param text
* @return JComponent
*/
private JComponent buildLabel(String text) {
JLabel label = new JLabel(text, JLabel.LEFT);
label.setBorder(new EmptyBorder(0, 15, 0, 0));
label.setFont(new Font("Segoe UI", Font.PLAIN, 9));
JPanel container = new JPanel(new BorderLayout(5, 0));
container.add(label, BorderLayout.WEST);
container.setAlignmentX(JLabel.LEFT_ALIGNMENT);
container.setOpaque(false);
return container;
}
示例5: 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;
}
示例6: VizCustomizationPanel
import javax.swing.JPanel; //導入方法依賴的package包/類
/** Constructs a customization panel.
* @param divider - the JSplitPane separating the left-customization-half with the right-graph-half
* @param vizState - the VizState object that will be customized by this customization panel
*/
public VizCustomizationPanel(JSplitPane divider, VizState vizState) {
this.divider = divider;
this.vizState = vizState;
setBorder(null);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
zoomPane = new JPanel();
zoomPane.setBorder(new OurBorder(false,false,true,false));
zoomPane.setLayout(new BoxLayout(zoomPane, BoxLayout.Y_AXIS));
zoomPane.setAlignmentX(0f);
zoomPane.setBackground(wcolor);
remakeAll();
}
示例7: VizCustomizationPanel
import javax.swing.JPanel; //導入方法依賴的package包/類
/**
* Constructs a customization panel.
*
* @param divider - the JSplitPane separating the left-customization-half
* with the right-graph-half
* @param vizState - the VizState object that will be customized by this
* customization panel
*/
public VizCustomizationPanel(JSplitPane divider, VizState vizState) {
this.divider = divider;
this.vizState = vizState;
setBorder(null);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
zoomPane = new JPanel();
zoomPane.setBorder(new OurBorder(false, false, true, false));
zoomPane.setLayout(new BoxLayout(zoomPane, BoxLayout.Y_AXIS));
zoomPane.setAlignmentX(0f);
zoomPane.setBackground(wcolor);
remakeAll();
}
示例8: generateControl
import javax.swing.JPanel; //導入方法依賴的package包/類
@Override
public JComponent generateControl()
{
field = new JTextField();
field.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));
if( items.size() >= 1 )
{
field.setText(((Item) items.get(0)).getValue());
}
JButton browse = new JButton("Browse");
browse.setIcon(new ImageIcon(getClass().getResource("/images/browse.gif")));
browse.setHorizontalTextPosition(SwingConstants.RIGHT);
Dimension browseSize = browse.getPreferredSize();
browseSize.height = 20;
browse.setMaximumSize(browseSize);
browse.addActionListener(this);
JPanel group = new JPanel();
group.setLayout(new BoxLayout(group, BoxLayout.X_AXIS));
group.add(field);
group.add(Box.createRigidArea(new Dimension(5, 0)));
group.add(browse);
group.setAlignmentX(Component.LEFT_ALIGNMENT);
return group;
}
示例9: setup
import javax.swing.JPanel; //導入方法依賴的package包/類
private void setup()
{
editor = new JPanel(new BorderLayout(5, 0));
editor.setAlignmentX(Component.LEFT_ALIGNMENT);
editor.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
BorderFactory.createEmptyBorder(2, 5, 2, 5)));
editor.add(createButtons(), BorderLayout.EAST);
editor.add(createCentre(), BorderLayout.CENTER);
}
示例10: setup
import javax.swing.JPanel; //導入方法依賴的package包/類
protected void setup()
{
editor = new JPanel(new BorderLayout(5, 0));
editor.setAlignmentX(Component.LEFT_ALIGNMENT);
editor.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
BorderFactory.createEmptyBorder(2, 5, 2, 5)));
editor.add(createButtons(), BorderLayout.EAST);
editor.add(createCentre(), BorderLayout.CENTER);
}
示例11: setup
import javax.swing.JPanel; //導入方法依賴的package包/類
@Override
protected void setup()
{
editor = new JPanel(new BorderLayout(5, 0));
editor.setAlignmentX(Component.LEFT_ALIGNMENT);
editor.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
BorderFactory.createEmptyBorder(2, 5, 2, 5)));
editor.add(createTop(), BorderLayout.NORTH);
editor.add(createButtons(), BorderLayout.EAST);
editor.add(createCentre(), BorderLayout.CENTER);
}
示例12: 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;
}
示例13: initComponents
import javax.swing.JPanel; //導入方法依賴的package包/類
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
private void initComponents() {
onchipBiasgenPanel = new JPanel();
onchipBiasgenPanel.setLayout(new BoxLayout(onchipBiasgenPanel, BoxLayout.Y_AXIS));
onchipBiasgenPanel.setAlignmentX(LEFT_ALIGNMENT);
addTab("On-chip biases (biasgen)", (onchipBiasgenPanel));
offchipDACPanel = new JPanel();
offchipDACPanel.setLayout(new BoxLayout(offchipDACPanel, BoxLayout.Y_AXIS));
addTab("Off-chip biases (DAC)", (offchipDACPanel));
channelPanel = new JPanel();
channelPanel.setLayout(new BoxLayout(channelPanel, BoxLayout.Y_AXIS));
addTab("Channels", (channelPanel));
scannerPanel = new JPanel();
scannerPanel.setLayout(new BoxLayout(scannerPanel, BoxLayout.Y_AXIS));
addTab("Scanner Config", (scannerPanel));
aerPanel = new JPanel();
aerPanel.setLayout(new BoxLayout(aerPanel, BoxLayout.Y_AXIS));
addTab("AER Config", (aerPanel));
adcPanel = new JPanel();
adcPanel.setLayout(new BoxLayout(adcPanel, BoxLayout.Y_AXIS));
addTab("ADC", (adcPanel));
chipDiagPanel = new JPanel();
chipDiagPanel.setAlignmentX(LEFT_ALIGNMENT);
chipDiagPanel.setLayout(new BoxLayout(chipDiagPanel, BoxLayout.Y_AXIS));
addTab("Chip Diag Config", (chipDiagPanel));
}
示例14: makeGUIControl
import javax.swing.JPanel; //導入方法依賴的package包/類
@Override
public JComponent makeGUIControl() {
final JPanel pan = new JPanel();
pan.setAlignmentX(Component.LEFT_ALIGNMENT);
pan.setLayout(new BoxLayout(pan, BoxLayout.X_AXIS));
final JLabel label = new JLabel(getName());
label.setToolTipText(
"<html>" + toString() + "<br>" + getDescription() + "<br>Enter value or use mouse wheel or arrow keys to change value.");
pan.add(label);
final JTextField tf = new JTextField();
tf.setText(Integer.toString(get()));
tf.setPreferredSize(prefDimensions);
tf.setMaximumSize(maxDimensions);
SPIConfigIntActions actionListeners = new SPIConfigIntActions(this);
tf.addActionListener(actionListeners);
tf.addFocusListener(actionListeners);
tf.addKeyListener(actionListeners);
tf.addMouseWheelListener(actionListeners);
pan.add(tf);
setControl(tf);
addObserver(biasgen); // This observer is responsible for sending data to hardware
addObserver(this); // This observer is responsible for GUI update. It calls the updateControl() method
return pan;
}
示例15: buildPanel
import javax.swing.JPanel; //導入方法依賴的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
}