本文整理汇总了Java中javax.swing.Box类的典型用法代码示例。如果您正苦于以下问题:Java Box类的具体用法?Java Box怎么用?Java Box使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Box类属于javax.swing包,在下文中一共展示了Box类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLine
import javax.swing.Box; //导入依赖的package包/类
private void addLine(List<Segment> line) {
if (line.size() == 1) {
addSegment(this, line.get(0));
} else {
Box lineBox = new Box(BoxLayout.LINE_AXIS);
if (lineBox.getComponentOrientation().isLeftToRight()) {
lineBox.setAlignmentX(LEFT_ALIGNMENT);
} else {
lineBox.setAlignmentX(RIGHT_ALIGNMENT);
}
for (Segment s : line) {
addSegment(lineBox, s);
}
add(lineBox);
}
}
示例2: createUnivariate
import javax.swing.Box; //导入依赖的package包/类
/**
* Sets up univariate statistics panel
*/
private void createUnivariate() {
Box mainBox = Box.createVerticalBox();
Box centralBox = Box.createHorizontalBox();
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(centralBox);
mainBox.add(Box.createVerticalStrut(10));
uniStatsPanel.add(mainBox);
// Pannello dei componenti univariate statistics panel
JPanel componentsPanel = new JPanel(new BorderLayout(0, 5));
// Aggiuna label descrizione
componentsPanel.add(new JLabel(UNIV_DESCRITPION), BorderLayout.NORTH);
componentsPanel.add(transfGraphCreate(), BorderLayout.SOUTH);
componentsPanel.add(getScrollPaneTable(), BorderLayout.CENTER);
// Aggiuna pannello dei componenti al tabbed pane univariate
centralBox.add(componentsPanel);
}
示例3: SchemaTreeCellRenderer
import javax.swing.Box; //导入依赖的package包/类
/**
* Simple constructor.
*/
public SchemaTreeCellRenderer() {
FlowLayout fl = new FlowLayout(FlowLayout.LEFT, 1, 1);
this.setLayout(fl);
this.iconLabel = new JLabel();
this.iconLabel.setOpaque(false);
this.iconLabel.setBorder(null);
this.add(this.iconLabel);
// add some space
this.add(Box.createHorizontalStrut(5));
this.nameLabel = new JLabel();
this.nameLabel.setOpaque(false);
this.nameLabel.setBorder(null);
this.nameLabel.setFont(nameFont);
this.add(this.nameLabel);
this.isSelected = false;
this.setOpaque(false);
this.setBorder(null);
}
示例4: minimumLayoutSize
import javax.swing.Box; //导入依赖的package包/类
public Dimension minimumLayoutSize(final Container parent) {
final Insets insets = parent.getInsets();
final Dimension d = new Dimension(insets.left + insets.right,
insets.top + insets.bottom);
int maxWidth = 0;
int visibleCount = 0;
for (Component comp : parent.getComponents()) {
if (comp.isVisible() && !(comp instanceof Box.Filler)) {
final Dimension size = comp.getPreferredSize();
maxWidth = Math.max(maxWidth, size.width);
d.height += size.height;
visibleCount++;
}
}
d.height += (visibleCount - 1) * vGap;
d.width += maxWidth;
return d;
}
示例5: setup
import javax.swing.Box; //导入依赖的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);
}
示例6: initPanneauBoutonValidation
import javax.swing.Box; //导入依赖的package包/类
/**
* Initialise le panneau du bouton de validation
*/
private void initPanneauBoutonValidation(){
this.setPanneauBoutousValidation(new JPanel());
this.getPanneauBoutousValidation().setLayout(new BoxLayout(this.getPanneauBoutousValidation(), BoxLayout.LINE_AXIS));
this.getPanneauBoutousValidation().setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
this.setBoutonValider(new JButton("Valider"));
this.setBoutonAnnule(new JButton("Annuler"));
this.getPanneauBoutousValidation().add(this.getBoutonValider());
this.getPanneauBoutousValidation().add(Box.createRigidArea(new Dimension(10, 0)));
this.getPanneauBoutousValidation().add(this.getBoutonAnnule());
this.getPanneauBoutousValidation().add(Box.createHorizontalGlue());
this.getContentPane().add(this.getPanneauBoutousValidation());
this.getPanneauBoutousValidation().setVisible(true);
}
示例7: init
import javax.swing.Box; //导入依赖的package包/类
private void init() {
JMenu pfMenu = new JMenu("Playfield graphics");
JMenu help = new JMenu("Help");
Settings settings = new Settings(UNDERLAY_NS);
if (settings.contains("fileName")) {
// create underlay image menu item only if filename is specified
enableBgImage = createCheckItem(pfMenu,"Show underlay image",false);
}
enableNodeName = createCheckItem(pfMenu, "Show node name string",true);
enableNodeCoverage = createCheckItem(pfMenu,
"Show node radio coverage", true);
enableNodeConnections = createCheckItem(pfMenu,
"Show node's connections", true);
enableMapGraphic = createCheckItem(pfMenu,"Show map graphic",true);
autoClearOverlay = createCheckItem(pfMenu, "Autoclear overlay",true);
clearOverlay = createMenuItem(pfMenu,"Clear overlays now");
about = createMenuItem(help,"about");
this.add(pfMenu);
this.add(Box.createHorizontalGlue());
this.add(help);
}
示例8: createTopPane
import javax.swing.Box; //导入依赖的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;
}
示例9: initGUI
import javax.swing.Box; //导入依赖的package包/类
private void initGUI() {
this.setIconImage(JMTImageLoader.loadImage(IMG_JWATICON).getImage());
this.setResizable(false);
this.setTitle("jWAT");
this.setSize(520, 400);
//Image image = new ImageIcon(imageURL).getImage();
//image = image.getScaledInstance(400, 315, Image.SCALE_SMOOTH);
JPanel eastPanel = new JPanel(new BorderLayout());
eastPanel.add(Box.createVerticalStrut(5), BorderLayout.NORTH);
JPanel buttonPanel = new JPanel(new GridLayout(buttonAction.length, 1, 2, 2));
eastPanel.add(buttonPanel, BorderLayout.CENTER);
for (AbstractAction element : buttonAction) {
buttonPanel.add(createButton(element));
}
JLabel imageLabel = new JLabel();
imageLabel.setBorder(BorderFactory.createEmptyBorder(BUTTONSIZE - 5, 1, 0, 0));
//imageLabel.setIcon(new ImageIcon(image));
imageLabel.setIcon(new ImageIcon(new ImageIcon(imageURL).getImage().getScaledInstance(400, 315, Image.SCALE_SMOOTH)));
imageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
imageLabel.setVerticalAlignment(SwingConstants.NORTH);
this.getContentPane().add(imageLabel, BorderLayout.CENTER);
this.getContentPane().add(eastPanel, BorderLayout.EAST);
}
示例10: createP3
import javax.swing.Box; //导入依赖的package包/类
JPanel createP3() {
p3 = new JPanel(new BorderLayout());
model = new DefaultListModel();
list = new JList(model);
list.setCellRenderer(new YTListRenderer());
p3.add(new JScrollPane(list));
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
btnDwnld = new JButton("Download");
btnDwnld.addActionListener(this);
btnCancel = new JButton("Close");
btnCancel.addActionListener(this);
box.add(btnDwnld);
box.add(Box.createHorizontalStrut(10));
box.add(btnCancel);
btnCancel.setPreferredSize(btnDwnld.getPreferredSize());
box.add(Box.createHorizontalStrut(10));
box.add(Box.createRigidArea(new Dimension(0, 40)));
p3.add(box, BorderLayout.SOUTH);
box.setOpaque(true);
box.setBackground(StaticResource.titleColor);
return p3;
}
示例11: TemplateEditor
import javax.swing.Box; //导入依赖的package包/类
public TemplateEditor(GrammarModel grammar) {
super(grammar, new SpringLayout());
setBackground(ExplorationDialog.INFO_BG_COLOR);
addName();
addExplanation();
add(Box.createRigidArea(new Dimension(0, 6)));
addKeyword();
addNrArguments();
add(Box.createRigidArea(new Dimension(0, 6)));
for (String argName : Template.this.argumentNames) {
addArgument(argName);
}
SpringUtilities.makeCompactGrid(this,
6 + Template.this.argumentNames.length,
1,
2,
2,
0,
0);
refresh();
}
示例12: setupUI
import javax.swing.Box; //导入依赖的package包/类
private void setupUI() {
frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
comboBox = new JComboBox<>(ITEMS);
JPanel scrollable = new JPanel();
scrollable.setLayout(new BoxLayout(scrollable, BoxLayout.Y_AXIS));
scrollable.add(Box.createVerticalStrut(200));
scrollable.add(comboBox);
scrollable.add(Box.createVerticalStrut(200));
scrollPane = new JScrollPane(scrollable);
frame.add(scrollPane);
frame.setSize(100, 200);
frame.setVisible(true);
}
示例13: createMatrixQQ
import javax.swing.Box; //导入依赖的package包/类
private void createMatrixQQ() {
Box mainBox = Box.createVerticalBox();
Box descBox = Box.createHorizontalBox();
Box tableBox = Box.createHorizontalBox();
scatterQQPlot.add(mainBox);
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(descBox);
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(tableBox);
mainBox.add(Box.createVerticalStrut(10));
descBox.add(new JLabel(QQ_MATRIX_DESCRIPTION));
qqMatrix = new DispQQPlotMatrix();
tableBox.add(qqMatrix);
}
示例14: setMessage
import javax.swing.Box; //导入依赖的package包/类
/** Specify a message to be displayed above the query.
* @param message The message to display.
*/
public void setMessage(String message) {
if (!_messageScrollPaneAdded) {
_messageScrollPaneAdded = true;
add(_messageScrollPane, 1);
// Add a spacer.
add(Box.createRigidArea(new Dimension(0, 10)), 2);
}
_messageArea.setText(message);
// I'm not sure why we need to add 1 here?
int lineCount = _messageArea.getLineCount() + 1;
// Keep the line count to less than 30 lines. If
// we have more than 30 lines, we get a scroll bar.
if (lineCount > 30) {
lineCount = 30;
}
_messageArea.setRows(lineCount);
_messageArea.setColumns(_width);
// In case size has changed.
validate();
}
示例15: initComponents
import javax.swing.Box; //导入依赖的package包/类
private void initComponents() {
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
synView = new JTextPane();
synView.setContentType("text/html");
synView.setEditable(false);
synScroll = new JScrollPane(synView);
synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
vBox.add(Box.createVerticalStrut(30));
vBox.add(hBox);
vBox.add(Box.createVerticalStrut(30));
hBox.add(Box.createHorizontalStrut(20));
hBox.add(synScroll);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1, 1));
this.add(vBox);
}