當前位置: 首頁>>代碼示例>>Java>>正文


Java FlowLayout類代碼示例

本文整理匯總了Java中java.awt.FlowLayout的典型用法代碼示例。如果您正苦於以下問題:Java FlowLayout類的具體用法?Java FlowLayout怎麽用?Java FlowLayout使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FlowLayout類屬於java.awt包,在下文中一共展示了FlowLayout類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: AlignmentPropertyEditor

import java.awt.FlowLayout; //導入依賴的package包/類
public AlignmentPropertyEditor() {
    super(
        new int[] {
            FlowLayout.CENTER,
            FlowLayout.LEFT,
            FlowLayout.RIGHT,
            FlowLayout.LEADING,
            FlowLayout.TRAILING
        },
        new String[] {
            "java.awt.FlowLayout.CENTER", // NOI18N
            "java.awt.FlowLayout.LEFT", // NOI18N
            "java.awt.FlowLayout.RIGHT", // NOI18N
            "java.awt.FlowLayout.LEADING", // NOI18N
            "java.awt.FlowLayout.TRAILING" // NOI18N
        },
        new String[] {
            "VALUE_AlignmentCenter", // NOI18N
            "VALUE_AlignmentLeft", // NOI18N
            "VALUE_AlignmentRight", // NOI18N
            "VALUE_AlignmentLeading", // NOI18N
            "VALUE_AlignmentTrailing" // NOI18N
        }
    );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:FlowLayoutBeanInfo.java

示例2: init

import java.awt.FlowLayout; //導入依賴的package包/類
@Override
public void init() {
    tf = new TextField(20);
    tf.setText("0123456789");
    tf.select(0, 6);

    final TextArea ta = new TextArea("INSTRUCTIONS:\n"
                                     + "The text 012345 should be selected in the TextField.\n"
                                     + "If this is what you observe, then the test passes.\n"
                                     + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    ta.setEditable(false);
    ta.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(tf);
    setLayout(new BorderLayout());
    add(ta, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:21,代碼來源:SelectionVisible.java

示例3: setup

import java.awt.FlowLayout; //導入依賴的package包/類
private static void setup(final Point tmp) {
    comboBox = new JComboBox<>();
    for (int i = 1; i < 7; i++) {
        comboBox.addItem("Long-long-long-long-long text in the item-" + i);
    }
    String property = System.getProperty(PROPERTY_NAME);
    comboBox.putClientProperty(PROPERTY_NAME, Boolean.valueOf(property));
    frame = new JFrame();
    frame.setAlwaysOnTop(true);
    frame.setLayout(new FlowLayout());
    frame.add(comboBox);
    frame.pack();
    frame.setSize(frame.getWidth(), SIZE);
    frame.setVisible(true);
    frame.setLocation(tmp.x, tmp.y);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:JComboBoxPopupLocation.java

示例4: jbInit

import java.awt.FlowLayout; //導入依賴的package包/類
private void jbInit() throws Exception {
    

    //this.setSize(200, 50);        
    this.setFocusable(false);        
    //this.setBackground();
    
    this.setPreferredSize(new Dimension(200, 45));
    this.setToolTipText("");
    flowLayout1.setHgap(0);
    flowLayout1.setVgap(0);
    flowLayout1.setAlignment(FlowLayout.LEFT);
    this.setLayout(flowLayout1);
    //this.getContentPane().add(cal,  BorderLayout.CENTER);
    createButtons();

}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:18,代碼來源:CharTablePanel.java

示例5: AntFoodsPanel

import java.awt.FlowLayout; //導入依賴的package包/類
public AntFoodsPanel(GUIFacade facade) {
	this.facade = facade;
	
	setLayout(new BorderLayout());
	
	setEvents();
	
	panel_buttons.setLayout(new FlowLayout());
	panel_buttons.add(button_set);
	panel_buttons.add(button_remove);
	
	list.setPreferredSize(new Dimension(70, 200));
	
	add(list, BorderLayout.WEST);
	add(antfoodView, BorderLayout.CENTER);
	add(panel_buttons, BorderLayout.SOUTH);
}
 
開發者ID:gamefest2017,項目名稱:ants,代碼行數:18,代碼來源:AntFoodsPanel.java

示例6: init

import java.awt.FlowLayout; //導入依賴的package包/類
/**
 * Init panel and helper elements.
 */
private void init() {
    this.setLayout(new FlowLayout(
            FlowLayout.LEADING, 0, 0));
    this.add(checkbox);
    this.add(buttonPanel);

    this.setMaximumSize(
            this.getMinimumSize());
    checkbox.addItemListener(this);
    if (checkbox.isSelected()) {
        buttonPanel.enableButton();
    } else {
        buttonPanel.disableButton();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:CheckBoxWithButtonPanel.java

示例7: init

import java.awt.FlowLayout; //導入依賴的package包/類
private void init() {
    btnTestFileNamePattern = new JButton();
    chkFileNameRegex = new JCheckBox();
    chkFileNameRegex.setToolTipText(UiUtils.getText(
            "BasicSearchForm.chkFileNameRegex.tooltip"));           //NOI18N

    if (!replacing) {
        chkArchives = new JCheckBox();
        chkGenerated = new JCheckBox();
    }
    chkUseIgnoreList = new JCheckBox();
    btnEditIgnoreList = new JButton();
    checkBoxListener = new CheckBoxListener();

    component.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
    setMnemonics();
    initIgnoreListControlComponents();
    initScopeOptionsRow(replacing);
    initInteraction();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:ScopeOptionsController.java

示例8: main

import java.awt.FlowLayout; //導入依賴的package包/類
public static void main(String[] args) {

        JFrame frame = new JFrame();
        frame.setLayout(new FlowLayout());
        frame.setVisible(true);
		
        JButton button1 = new JButton("點我!");
        JButton button2 = new JButton("也點我!");
		
        frame.getContentPane().add(button1);
        frame.getContentPane().add(button2);
        //這裏addActionListener方法的參數是ActionListener,是一個函數式接口
        //使用lambda表達式方式
        button1.addActionListener(e -> { System.out.println("這裏是Lambda實現方式"); });
        //使用方法引用方式
        button2.addActionListener(TestMethodReference::doSomething);
        
    }
 
開發者ID:juebanlin,項目名稱:util4j,代碼行數:19,代碼來源:TestMethodReference.java

示例9: initComponents

import java.awt.FlowLayout; //導入依賴的package包/類
private void initComponents() {
    setLayout(new BorderLayout());

    previewPanel = new JPanel(new FlowLayout(0, 0, FlowLayout.LEADING));
    previewPanel.setBorder(BorderFactory.createEmptyBorder(4, 7, 2, 7));

    label = new JLabel();
    label.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 7, 7, 7),
                                                       new ThinBevelBorder(BevelBorder.LOWERED)));
    label.setBorder(BorderFactory.createCompoundBorder(label.getBorder(), BorderFactory.createEmptyBorder(4, 3, 4, 3)));
    label.setFont(label.getFont().deriveFont(Font.BOLD));

    JPanel p = new JPanel(new BorderLayout());
    p.setBorder(BorderFactory.createRaisedBevelBorder());
    p.add(previewPanel, BorderLayout.NORTH);
    p.add(label, BorderLayout.CENTER);

    add(p, BorderLayout.CENTER);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:ToggleProfilingPointAction.java

示例10: StatusLineComponent

import java.awt.FlowLayout; //導入依賴的package包/類
public StatusLineComponent() {
        handleComponentMap = new HashMap<InternalHandle, ListComponent>();
        FlowLayout flay = new FlowLayout();
        flay.setVgap(1);
        flay.setHgap(5);
        setLayout(flay);
        mouseListener = new MListener();
        addMouseListener(mouseListener);
        hideListener = new HideAWTListener();
        
        createLabel();
        createBar();
        // tricks to figure out correct height.
        bar.setStringPainted(true);
        bar.setString("@@@"); // NOI18N
        label.setText("@@@"); // NOI18N
        preferredHeight = Math.max(label.getPreferredSize().height, bar.getPreferredSize().height) + 3;
        setOpaque(false);
        discardLabel();
        discardBar();
        
        pane = new PopupPane();
        pane.getActionMap().put("HidePopup", new AbstractAction() {
            public @Override void actionPerformed(ActionEvent actionEvent) {
//                System.out.println("escape pressed - hiding");
                hidePopup();
            }
        });
        pane.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "HidePopup");
        pane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "HidePopup");
        
        
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:34,代碼來源:StatusLineComponent.java

示例11: makeButtonPanel

import java.awt.FlowLayout; //導入依賴的package包/類
protected JPanel makeButtonPanel(AbstractButton... buttons) {
	JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP, GAP));
	for (final AbstractButton button : buttons) {
		if (button != null) {
			buttonPanel.add(button);
			button.addActionListener(new ActionListener() {

				@Override
				public void actionPerformed(ActionEvent e) {
					ActionStatisticsCollector.getInstance().log(ActionStatisticsCollector.TYPE_DIALOG, key,
							button.getActionCommand());
				}
			});
		}
	}
	return buttonPanel;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:18,代碼來源:ButtonDialog.java

示例12: jbInit

import java.awt.FlowLayout; //導入依賴的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

示例13: ActionEventTest

import java.awt.FlowLayout; //導入依賴的package包/類
public ActionEventTest() {
    try {
        robot = new Robot();
        robot.setAutoDelay(100);
        robot.setAutoWaitForIdle(true);
    } catch(AWTException e) {
        throw new RuntimeException(e.getMessage());
    }

    list = new List(1, false);
    list.add("0");
    add(list);
    setSize(400,400);
    setLayout(new FlowLayout());
    pack();
    setVisible(true);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:ActionEventTest.java

示例14: Main_AllRooms

import java.awt.FlowLayout; //導入依賴的package包/類
/**
 * Create the dialog.
 */
public Main_AllRooms() {

    bean = LocaleBean.getInstance();
    componentOrientation = new ChangeComponentOrientation();
    componentOrientation.setThePanel(contentPanel);

    systemStatus = systemStatusImpl.getSystemStatus();

    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPanel.setBackground(Color.decode("#066d95"));
    contentPanel.setPreferredSize(new Dimension(700, 1000));
    contentPanel.setLayout(new FlowLayout());

    cookRooms(contentPanel);

    //change component orientation with locale.
    if (bean.getLocale().toString().equals("ar_IQ")) {
        componentOrientation.changeOrientationOfJPanelToRight();
    } else {
        componentOrientation.changeOrientationOfJPanelToLeft();
    }

    contentPanel.setVisible(true);
}
 
開發者ID:Coder-ACJHP,項目名稱:Hotel-Properties-Management-System,代碼行數:28,代碼來源:Main_AllRooms.java

示例15: ItemEventTest

import java.awt.FlowLayout; //導入依賴的package包/類
public ItemEventTest()
{
    try {
        robot = new Robot();
    } catch(AWTException e) {
        throw new RuntimeException(e.getMessage());
    }
    expectedSelectionOrder = "01230123";

    list = new List(4, true);
    list.add("0");
    list.add("1");
    list.add("2");
    list.add("3");

    add(list);
    setSize(400,400);
    setLayout(new FlowLayout());
    pack();
    setVisible(true);
    robot.waitForIdle();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:ItemEventTest.java


注:本文中的java.awt.FlowLayout類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。