当前位置: 首页>>代码示例>>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;未经允许,请勿转载。