本文整理匯總了Java中javax.swing.BoxLayout類的典型用法代碼示例。如果您正苦於以下問題:Java BoxLayout類的具體用法?Java BoxLayout怎麽用?Java BoxLayout使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BoxLayout類屬於javax.swing包,在下文中一共展示了BoxLayout類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawActivations
import javax.swing.BoxLayout; //導入依賴的package包/類
@Override
public void drawActivations() {
if (!isVisible() || (activations == null)) {
return;
}
checkActivationsFrame();
if (imageDisplay == null) {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
imageDisplay = ImageDisplay.createOpenGLCanvas();
imageDisplay.setBorderSpacePixels(0);
imageDisplay.setImageSize(dimx, dimy);
imageDisplay.setSize(200, 200);
panel.add(imageDisplay);
activationsFrame.getContentPane().add(panel);
activationsFrame.pack();
}
for (int x = 0; x < dimx; x++) {
for (int y = 0; y < dimy; y++) {
imageDisplay.setPixmapGray(x ,dimx - y - 1, (a(0, x, y))); // try to fit mean 0 std 1 into 0-1 range nicely by offset and gain of .5
}
}
imageDisplay.repaint();
}
示例2: ResultViewPanel
import javax.swing.BoxLayout; //導入依賴的package包/類
public ResultViewPanel(SearchTask searchTask) {
setLayout(resultViewCards = new CardLayout());
this.searchComposition = searchTask.getComposition();
this.searchTask = searchTask;
SearchResultsDisplayer<?> displayer =
searchComposition.getSearchResultsDisplayer();
setName(displayer.getTitle());
displayer.setInfoNode(this.createListener().getInfoNode());
resultsPanel = new JPanel();
resultsPanel.setLayout(
new BoxLayout(resultsPanel, BoxLayout.PAGE_AXIS));
SearchResultsDisplayer<?> disp =
searchComposition.getSearchResultsDisplayer();
visualComponent = disp.getVisualComponent();
lookup = (visualComponent instanceof Lookup.Provider)
? ((Lookup.Provider) visualComponent).getLookup()
: Lookup.EMPTY;
resultsPanel.add(visualComponent);
add(resultsPanel, CARD_NAME_RESULTS);
showInfo(UiUtils.getText("TEXT_WAITING_FOR_PREVIOUS")); //NOI18N
}
示例3: ExperimentalOptions
import javax.swing.BoxLayout; //導入依賴的package包/類
public ExperimentalOptions(PreferencesFrame window) {
super(window);
accel = new PrefOptionList(AppPreferences.GRAPHICS_ACCELERATION, Strings.getter("accelLabel"),
new PrefOption[] { new PrefOption(AppPreferences.ACCEL_DEFAULT, Strings.getter("accelDefault")),
new PrefOption(AppPreferences.ACCEL_NONE, Strings.getter("accelNone")),
new PrefOption(AppPreferences.ACCEL_OPENGL, Strings.getter("accelOpenGL")),
new PrefOption(AppPreferences.ACCEL_D3D, Strings.getter("accelD3D")), });
JPanel accelPanel = new JPanel(new BorderLayout());
accelPanel.add(accel.getJLabel(), BorderLayout.LINE_START);
accelPanel.add(accel.getJComboBox(), BorderLayout.CENTER);
JPanel accelPanel2 = new JPanel();
accelPanel2.add(accelPanel);
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
add(Box.createGlue());
add(accelPanel2);
add(Box.createGlue());
}
示例4: setOrientation
import javax.swing.BoxLayout; //導入依賴的package包/類
public void setOrientation(Object value) {
int axis;
String position;
if (value == HORIZONTAL) {
axis = BoxLayout.X_AXIS;
position = BorderLayout.LINE_START;
} else if (value == VERTICAL) {
axis = BoxLayout.Y_AXIS;
position = BorderLayout.NORTH;
} else {
throw new IllegalArgumentException();
}
this.remove(subpanel);
subpanel.setLayout(new BoxLayout(subpanel, axis));
this.add(subpanel, position);
this.orientation = value;
}
示例5: buildAttrEditorPanel
import javax.swing.BoxLayout; //導入依賴的package包/類
private void buildAttrEditorPanel() {
attrEditorPanel.setLayout(new BorderLayout());
attrEditorPanel.setBorder(BorderFactory.createTitledBorder(NEW_ATTR_TITLE));
JPanel namePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
namePanel.add(new JLabel("Name: "));
namePanel.add(newAttrName);
JPanel typePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
typePanel.add(new JLabel("Type: "));
typePanel.add(newAttrType);
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
mainPanel.add(namePanel);
mainPanel.add(typePanel);
JPanel buttonsPanel = new JPanel();
buttonsPanel.add(addAttrButton);
attrEditorPanel.add(mainPanel, BorderLayout.CENTER);
attrEditorPanel.add(buttonsPanel, BorderLayout.SOUTH);
addAttrButton.addActionListener(new AddAttrListener());
newAttrName.addActionListener(new AddAttrListener());
}
示例6: run
import javax.swing.BoxLayout; //導入依賴的package包/類
@Override
public void run() {
frame = new JFrame();
frame.setTitle("Results - jOthelloT");
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
JScrollPane mainScroll = new JScrollPane(panel);
mainScroll.getVerticalScrollBar().setUnitIncrement(16);
mainScroll.setPreferredSize(new Dimension(800, 600));
frame.getContentPane().add(mainScroll, BorderLayout.CENTER);
JButton button = new JButton("Save");
button.addActionListener((ActionEvent e) -> {
saveResults(othelloChampionship.getBtResult(), othelloChampionship.getPartialResults(),othelloChampionship.getlistQualifying());
});
frame.getContentPane().add(button, BorderLayout.SOUTH);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
示例7: getObject
import javax.swing.BoxLayout; //導入依賴的package包/類
protected JPanel getObject() {
Box vBox = Box.createVerticalBox();
vBox.add(new JButton("button"));
vBox.add(Box.createVerticalStrut(10));
vBox.add(new JLabel("label"));
vBox.add(Box.createVerticalGlue());
vBox.add(new JButton("button"));
vBox.add(Box.createVerticalStrut(10));
vBox.add(new JLabel("label"));
Box hBox = Box.createHorizontalBox();
hBox.add(new JButton("button"));
hBox.add(Box.createHorizontalStrut(10));
hBox.add(new JLabel("label"));
hBox.add(Box.createHorizontalGlue());
hBox.add(new JButton("button"));
hBox.add(Box.createHorizontalStrut(10));
hBox.add(new JLabel("label"));
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(vBox);
panel.add(Box.createGlue());
panel.add(hBox);
return panel;
}
示例8: MainToolBar
import javax.swing.BoxLayout; //導入依賴的package包/類
MainToolBar(@NonNull final Pair<JComponent,GridBagConstraints>... components) {
super(BoxLayout.X_AXIS);
setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 5));
final JToolBar toolbar = new NoBorderToolBar(JToolBar.HORIZONTAL);
toolbar.setFloatable(false);
toolbar.setRollover(true);
toolbar.setBorderPainted(false);
toolbar.setBorder(BorderFactory.createEmptyBorder());
toolbar.setOpaque(false);
toolbar.setFocusable(false);
toolbar.setLayout(new GridBagLayout());
for (Pair<JComponent,GridBagConstraints> p : components) {
toolbar.add(p.first(),p.second());
}
add (toolbar);
}
示例9: createTopPane
import javax.swing.BoxLayout; //導入依賴的package包/類
private JComponent createTopPane() {
inputField = new JTextField(40);
inputField.addActionListener( (e) -> sendMessage() );
inputField.setMaximumSize( inputField.getPreferredSize() );
JButton sendButton = new JButton( getLocalizedComponentText("sendButton") );
sendButton.addActionListener( (e) -> sendMessage() );
JPanel pane = new JPanel();
pane.setLayout( new BoxLayout(pane, BoxLayout.LINE_AXIS) );
crSwitch = new JToggleButton("CR", true);
lfSwitch = new JToggleButton("LF", true);
pane.add( inputField );
pane.add( Box.createRigidArea( new Dimension(5, 0) ) );
pane.add( sendButton );
pane.add( Box.createGlue() );
pane.add( crSwitch );
pane.add( Box.createRigidArea( new Dimension(5, 0) ) );
pane.add( lfSwitch );
pane.setBorder( BorderFactory.createEmptyBorder(3, 3, 3, 0) );
return pane;
}
示例10: init
import javax.swing.BoxLayout; //導入依賴的package包/類
protected void init(JLabel[] labels, Component[] components) {
// Lay out the buttons from left to right.
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(cancelButton);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(okButton);
// Put everything together, using the content pane's BorderLayout.
Container contentPane = getContentPane();
contentPane.add(setupTextFields(labels, components),
BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.PAGE_END);
pack();
setLocationRelativeTo(frameComp);
setVisible(true);
}
示例11: getSoundsJPanel
import javax.swing.BoxLayout; //導入依賴的package包/類
/**
* @return
*/
final private JPanel getSoundsJPanel() {
final JPanel objLsoundsJCheckBoxesJPanel = new JPanel(new GridBagLayout());
objLsoundsJCheckBoxesJPanel.setOpaque(true);
final ExtendedGridBagConstraints objLjCheckBoxesExtendedGridBagConstraints = new ExtendedGridBagConstraints(GridBagConstraints.RELATIVE, 0);
objLsoundsJCheckBoxesJPanel.add(this.objGbooleanLocalJCheckBoxA[PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_SOUNDS]);
final JPanel objLsoundsJCheckBoxJPanel = new JPanel();
objLsoundsJCheckBoxJPanel.setLayout(new BoxLayout(objLsoundsJCheckBoxJPanel, BoxLayout.LINE_AXIS));
objLsoundsJCheckBoxJPanel.add(this.objGbooleanLocalJLabelA[PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_SOUNDS]);
objLsoundsJCheckBoxJPanel.add(new JLabel(" :"));
objLsoundsJCheckBoxesJPanel.add(objLsoundsJCheckBoxJPanel, objLjCheckBoxesExtendedGridBagConstraints);
byte bytLposY = 1;
for (final byte bytLbooleanLocalIndex : new byte[] { PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_CATCH_SOUNDS,
PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_THROW_SOUNDS, PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_METRONOME }) {
final JPanel objLjPanel = new JPanel();
objLjPanel.setLayout(new BoxLayout(objLjPanel, BoxLayout.LINE_AXIS));
objLjPanel.add(this.objGbooleanLocalJCheckBoxA[bytLbooleanLocalIndex]);
objLjPanel.add(this.objGbooleanLocalJLabelA[bytLbooleanLocalIndex]);
this.setSoundsJLabelsEnabled();
objLjCheckBoxesExtendedGridBagConstraints.setGridLocation(1, bytLposY++);
objLsoundsJCheckBoxesJPanel.add(objLjPanel, objLjCheckBoxesExtendedGridBagConstraints);
}
return objLsoundsJCheckBoxesJPanel;
}
示例12: MainView
import javax.swing.BoxLayout; //導入依賴的package包/類
public MainView() {
super("CormagBot (TwitchChatBot)");
this.essentials = new ScreenEssentials();
this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.X_AXIS));
this.setVisible(true);
this.setResizable(false);
this.setPreferredSize(this.essentials.getFrameSize());
this.setLocation(this.essentials.getFrameLocation());
managePanels();
manageTextFields();
manageButtons();
addComponents();
pack();
}
示例13: TablePanel
import javax.swing.BoxLayout; //導入依賴的package包/類
public TablePanel(Table aTable) {
table = aTable;
innerPanel = new JPanel();
add(innerPanel);
// Adding the panel's border padding
setLayout(new FlowLayout(FlowLayout.LEFT));
innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
innerPanel.setBorder(BorderFactory.createEmptyBorder(NEW_TABLE_PANEL_TOP_PADDING,
NEW_TABLE_PANEL_LEFT_PADDING,
NEW_TABLE_PANEL_BOTTOM_PADDING,
NEW_TABLE_PANEL_RIGHT_PADDING));
// Fill the panel with the attributes info
addAttributes();
// Common settings
setBackground(BACKGROUND_COLOR);
innerPanel.setBackground(BACKGROUND_COLOR);
}
示例14: setup
import javax.swing.BoxLayout; //導入依賴的package包/類
@Override
public void setup(String title, int total)
{
JPanel all = new JPanel();
all.setLayout(new BoxLayout(all, BoxLayout.Y_AXIS));
all.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
all.add(createHeader());
all.add(Box.createRigidArea(new Dimension(0, 10)));
all.add(createWholeProgress(total));
all.add(Box.createRigidArea(new Dimension(0, 10)));
all.add(createCurrentProgress());
all.add(Box.createRigidArea(new Dimension(0, 10)));
all.add(createMessageArea());
all.add(Box.createRigidArea(new Dimension(0, 10)));
all.add(createButtons());
getContentPane().add(all);
setTitle(title);
setSize(500, 500);
setDefaultCloseOperation(EXIT_ON_CLOSE);
ComponentHelper.centreOnScreen(this);
setVisible(true);
}
示例15: create2ColPane
import javax.swing.BoxLayout; //導入依賴的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;
}