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


Java Box类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ConnectionErrorDlg.java

示例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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:24,代码来源:StatsPanel.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:SchemaTreeTraverser.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:VerticalLayout.java

示例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);
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:ProgressWindow.java

示例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);
}
 
开发者ID:TeamLDCCIIT,项目名称:Java_GestionProjet,代码行数:21,代码来源:FenetreOption.java

示例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);
}
 
开发者ID:mdonnyk,项目名称:the-one-mdonnyk,代码行数:22,代码来源:SimMenuBar.java

示例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;
}
 
开发者ID:chipKIT32,项目名称:chipKIT-importer,代码行数:27,代码来源:SerialMonitorDisplayPane.java

示例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);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:24,代码来源:JWatStartScreen.java

示例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;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:25,代码来源:YoutubeGrabberDlg.java

示例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();
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:22,代码来源:Template.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:bug8136998.java

示例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);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:18,代码来源:StatsPanel.java

示例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();
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:27,代码来源:Query.java

示例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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:19,代码来源:SynopsisPanel.java


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