本文整理汇总了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());
}
示例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");
}
示例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);
}
示例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());
}
}
示例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);
}
示例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;
}
}
示例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);
}
示例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();
}
};
}
示例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);
}
}
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}