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


Java BorderLayout类代码示例

本文整理汇总了Java中java.awt.BorderLayout的典型用法代码示例。如果您正苦于以下问题:Java BorderLayout类的具体用法?Java BorderLayout怎么用?Java BorderLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BorderLayout类属于java.awt包,在下文中一共展示了BorderLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.awt.BorderLayout; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

        Robot robot = new Robot();
        SwingUtilities.invokeAndWait(() -> {
            frame = new JFrame();
            frame.setSize(500, 500);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

            tabbedPane = new JTabbedPane();

            for (int i = 0; i < TAB_COUNT; i++) {
                tabbedPane.add("Header " + i, new JLabel("Content: " + i));
            }

            frame.getContentPane().setLayout(new BorderLayout());
            frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
            frame.setVisible(true);
        });

        robot.waitForIdle();

        SwingUtilities.invokeAndWait(() -> {
            for (int j = 0; j < ITERATIONS; j++) {
                for (int i = 0; i < TAB_COUNT; i++) {
                    tabbedPane.setTitleAt(i, getHtmlText(j * TAB_COUNT + i));
                }
            }
        });
        robot.waitForIdle();

        SwingUtilities.invokeAndWait(() -> frame.dispose());
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:bug8017284.java

示例2: MessageTextArea

import java.awt.BorderLayout; //导入依赖的package包/类
public MessageTextArea(boolean editable, String text, String labelText) {
    setLayout(new BorderLayout());

    area = new JTextArea("");
    area.setSize(400, 400);
    area.setWrapStyleWord(true);
    area.setAutoscrolls(true);
    area.setLineWrap(true);
    area.setEditable(editable);
    area.setText(text);

    JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.getViewport().add(area);
    scrollPane.setDoubleBuffered(true);
    add(scrollPane, "Center");

    JLabel message = new JLabel(labelText);
    add(message, "North");
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:21,代码来源:MessageWindow.java

示例3: CellRenderer

import java.awt.BorderLayout; //导入依赖的package包/类
/**
 * Empty constructor with the correct visibility.
 * @param tree the enclosing checkbox tree
 */
CellRenderer(CheckboxTree tree) {
    this.tree = tree;
    this.jLabel = new DefaultTreeCellRenderer();
    this.jLabel.setOpenIcon(null);
    this.jLabel.setLeafIcon(null);
    this.jLabel.setClosedIcon(null);
    this.jLabel.setBorder(INSET_BORDER);
    this.checkbox = new JCheckBox();
    this.checkbox.setOpaque(false);
    setLayout(new BorderLayout());
    add(this.jLabel, BorderLayout.CENTER);
    add(this.checkbox, CheckboxTree.CHECKBOX_ORIENTATION);
    setBorder(new EmptyBorder(0, 2, 0, 0));
    setComponentOrientation(this.tree.getComponentOrientation());
    setOpaque(false);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:21,代码来源:CheckboxTree.java

示例4: toggleButton_actionPerformed

import java.awt.BorderLayout; //导入依赖的package包/类
void toggleButton_actionPerformed(ActionEvent e) {
    if (expanded) {
        expanded = false;
        toggleButton.setIcon(expIcon);
        controlPanel.remove(toggleToolBar);
        controlPanel.add(toggleToolBar, BorderLayout.EAST);
        splitPane.setDividerLocation((int) controlPanel.getMinimumSize().getWidth());

    }
    else {
        expanded = true;
        toggleButton.setIcon(collIcon);
        controlPanel.remove(toggleToolBar);
        controlPanel.add(toggleToolBar, BorderLayout.SOUTH);
        splitPane.setDividerLocation((int) controlPanel.getPreferredSize().getWidth());
    }
}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:18,代码来源:DailyItemsPanel.java

示例5: InfoPage

import java.awt.BorderLayout; //导入依赖的package包/类
/**
 * Create the application.
 */
public InfoPage() {
	setBounds(100, 100, 450, 300);		
	getContentPane().setLayout(new BorderLayout());
	contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
	getContentPane().add(contentPanel, BorderLayout.CENTER);
	contentPanel.setLayout(null);
	{
		JLabel lblInstructions = new JLabel("INFORMATION");
		lblInstructions.setFont(new Font("Lucida Grande", Font.BOLD, 40));
		lblInstructions.setHorizontalAlignment(SwingConstants.CENTER);
		lblInstructions.setBounds(70, 6, 325, 48);
		contentPanel.add(lblInstructions);
	}
	
	JTextArea txtrTest = new JTextArea();
	txtrTest.setText("Rule 1:\n\nRule 2:\n\nRule 3:\n\nRule 4:\n\nRule 5:\n\nRule 6:\n\nRule 7:\n……..");
	txtrTest.setBounds(17, 52, 415, 181);
	txtrTest.setEditable(false);
	txtrTest.setAutoscrolls(true);
	
	
	contentPanel.add(txtrTest);
}
 
开发者ID:verbalhanglider,项目名称:se459_team9_trivia_game,代码行数:27,代码来源:InfoPage.java

示例6: showPasswordDialog

import java.awt.BorderLayout; //导入依赖的package包/类
/**
 * Show password dialog if enabled
 */
private String showPasswordDialog() {
	JPanel panel = new JPanel(new BorderLayout());
	JPasswordField pf = new JPasswordField();
	panel.setBorder(new EmptyBorder(0, 10, 0, 10));
	panel.add(pf, BorderLayout.NORTH);
	JFrame frame = new JFrame();
	frame.setAlwaysOnTop(true);
	pf.requestFocus();

	int option = JOptionPane.showConfirmDialog(frame, panel, I18n.get("main.start.sharelinkpwd"),
			JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
	frame.dispose();
	if (option == JOptionPane.OK_OPTION) {
		return new String(pf.getPassword());
	} else {
		return null;
	}
}
 
开发者ID:michaelnetter,项目名称:dracoon-dropzone,代码行数:22,代码来源:Dropzone.java

示例7: jbInit

import java.awt.BorderLayout; //导入依赖的package包/类
void jbInit() throws Exception {
	border1 =
			BorderFactory.createCompoundBorder(
					BorderFactory.createEtchedBorder(
							Color.white,
							new Color(156, 156, 158)),
							BorderFactory.createEmptyBorder(5, 5, 5, 5));
	border2 = BorderFactory.createEmptyBorder(5, 0, 5, 0);
	panel1.setLayout(borderLayout1);
	this.getContentPane().setLayout(borderLayout2);

	bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
	topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
	topPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5)));
	topPanel.setBackground(Color.WHITE);

	jPanel1.setLayout(borderLayout3);
	panel1.setBorder(border1);
	jPanel1.setBorder(border2);

	getContentPane().add(panel1, BorderLayout.CENTER);
	panel1.add(jScrollPane1, BorderLayout.CENTER);
	jScrollPane1.getViewport().add(stickerText, null);
	panel1.add(jPanel1, BorderLayout.SOUTH);
	this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
	this.getContentPane().add(topPanel, BorderLayout.NORTH);

	stickerText.setText(txt);
	stickerText.setOpaque(true);
	stickerText.setBackground(backGroundColor);
	stickerText.setForeground(foreGroundColor);
}
 
开发者ID:ser316asu,项目名称:SER316-Munich,代码行数:33,代码来源:StickerExpand.java

示例8: ChoosingDriverUI

import java.awt.BorderLayout; //导入依赖的package包/类
/** Creates new form ChoosingDriverUI */
public ChoosingDriverUI(ChoosingDriverPanel panel, JDBCDriver driver, AddConnectionWizard wizard) {
    this.drv = driver;
    this.wp = panel;
    this.wizard = wizard;
    initComponents();
    DatabaseExplorerInternalUIs.connect(cbDrivers, JDBCDriverManager.getDefault(), false);
    if (drv == null) {
        cbDrivers.setSelectedIndex(0);
    } else {
        cbDrivers.setSelectedItem(drv);
    }
    customizeDriverPanel = new AddDriverDialog(drv, this, wizard);
    pInter.add(customizeDriverPanel, BorderLayout.CENTER);
    actionListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateState();
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:ChoosingDriverUI.java

示例9: valueChanged

import java.awt.BorderLayout; //导入依赖的package包/类
public void valueChanged(ListSelectionEvent e) {
	if (!e.getValueIsAdjusting()) {
		switch (clustList.getSelectedIndex()) {
			case 0:
				optClustering.removeAll();
				optClustering.add(new KMeansOptPanel(ClusterPanel.this, new loadListener(), model), BorderLayout.CENTER);
				optClustering.revalidate();
				optClustering.repaint();
				if (session.getListOfClustering().size() == 0) {
					canGoOn = false;
				}
				break;
			case 1:
				optClustering.removeAll();
				optClustering.add(new FuzzyOptPanel(ClusterPanel.this, new loadListener(), model), BorderLayout.CENTER);
				optClustering.revalidate();
				optClustering.repaint();
				if (session.getListOfClustering().size() == 0) {
					canGoOn = false;
				}
				break;
			default:
				clustList.setSelectedIndex(0);
		}
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:27,代码来源:ClusterPanel.java

示例10: showError

import java.awt.BorderLayout; //导入依赖的package包/类
public void showError(final String message) {
    if (!SwingUtilities.isEventDispatchThread()) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                showError(message);
            }
        });
        return;
    }
    removeAll();
    msgLabel.setIcon(null);
    msgLabel.setForeground(Color.GRAY);
    msgLabel.setText(NbBundle.getMessage(AbstractXMLNavigatorContent.class, message));
    msgLabel.setHorizontalAlignment(SwingConstants.CENTER);
    add(emptyPanel, BorderLayout.CENTER);
    revalidate();
    repaint();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AbstractXMLNavigatorContent.java

示例11: MainFrame

import java.awt.BorderLayout; //导入依赖的package包/类
public MainFrame(Deck deck) {
    super("Game of Set");
    this.cardsPanel = new CardsPanel(this);
    this.infoPanel = new InfoPanel(this);
    this.setLayout(new BorderLayout());
    this.deck = deck;
    this.setSize(600, 780);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
    this.add(cardsPanel, BorderLayout.CENTER);
    this.add(infoPanel, BorderLayout.SOUTH);
    this.setVisible(true);
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setBoard = new SetBoard(deck);
    this.setFinder = new SetFinder(setBoard.getFlippedCards());

    if (noPossibleSets()) {
        flipThreeMoreCards();
    }
    updatePanels();
}
 
开发者ID:mlpinit,项目名称:GameOfSet,代码行数:22,代码来源:MainFrame.java

示例12: ResultTab

import java.awt.BorderLayout; //导入依赖的package包/类
public ResultTab(String id) {
	setLayout(new BorderLayout());
	this.id = id;
	this.dockKey = new DockKey(id, "Result " + id);
	this.dockKey.setDockGroup(MainFrame.DOCK_GROUP_RESULTS);
	this.dockKey.setName(id);
	this.dockKey.setFloatEnabled(true);
	this.dockKey.setIconDisplayed(true);
	DockableActionCustomizer customizer = new DockableActionCustomizer() {

		@Override
		public void visitTabSelectorPopUp(JPopupMenu popUpMenu, Dockable dockable) {
			popUpMenu.add(new JMenuItem(new StoreInRepositoryAction(resultObject)));
			popUpMenu.add(new JMenuItem(new CloseAllResultsAction(RapidMinerGUI.getMainFrame())));
		}
	};
	customizer.setTabSelectorPopUpCustomizer(true); // enable tabbed dock custom popup menu
	// entries
	this.dockKey.setActionCustomizer(customizer);
	label = makeStandbyLabel();
	add(label, BorderLayout.CENTER);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:ResultTab.java

示例13: MapEditorTransformPanel

import java.awt.BorderLayout; //导入依赖的package包/类
/**
 * Creates a panel to choose a map transform.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public MapEditorTransformPanel(FreeColClient freeColClient) {
    super(freeColClient, new BorderLayout());

    nativeNation = first(getSpecification().getIndianNations());

    listPanel = new JPanel(new GridLayout(2, 0));

    group = new ButtonGroup();
    //Add an invisible, move button to de-select all others
    group.add(new JToggleButton());
    buildList();

    JScrollPane sl = new JScrollPane(listPanel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sl.getViewport().setOpaque(false);
    add(sl);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:24,代码来源:MapEditorTransformPanel.java

示例14: buildLeftPanel

import java.awt.BorderLayout; //导入依赖的package包/类
private void buildLeftPanel() {
	String[] tablesNames = getDatabase().getTablesNames();
	setCommonBorder(getLeftPanel(), "Tables");
	
	tablesViewer = new TablesViewer(database.getTables());
	JScrollPane tablesListSP = new JScrollPane(tablesViewer);
	tablesListSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
	
	// Listeners for the graphic tables
	setPanelsListeners();
	
	JPanel buttonsPanel = new JPanel();
	buttonsPanel.add(getAddTableButton());
	buttonsPanel.add(getEraseTableButton());
	buttonsPanel.add(getModifyTableButton());
	getLeftPanel().add(buttonsPanel, BorderLayout.SOUTH);
	getLeftPanel().add(tablesListSP, BorderLayout.CENTER);
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:19,代码来源:TablesManagerWindow.java

示例15: main

import java.awt.BorderLayout; //导入依赖的package包/类
public static void main(String [] args)
{
	JTimePanel v_JTimePanel = new JTimePanel();
	
	JFrame     v_Frame = new JFrame();
	JTextField v_Text  = new JTextField();
	
	v_Text.setBackground(Color.ORANGE);
	
	v_JTimePanel.addTimeChangeListener(new JTimePanelTest(v_Text));
	
	Date v_Now = new Date();
	
	v_JTimePanel.setValue(v_Now);
	
	v_Frame.getContentPane().setLayout(new BorderLayout());
	v_Frame.getContentPane().add(v_JTimePanel ,BorderLayout.CENTER);
	v_Frame.getContentPane().add(v_Text       ,BorderLayout.SOUTH);
	
	v_Frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
	v_Frame.setSize(800, 600);
	v_Frame.setVisible(true);
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.ui,代码行数:24,代码来源:JTimePanelTest.java


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