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


Java GridBagLayout类代码示例

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


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

示例1: DetectorPanel

import java.awt.GridBagLayout; //导入依赖的package包/类
public DetectorPanel(){
	setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	setPreferredSize(new Dimension(250,130));
	setBackground(Color.WHITE);

	this.detectorLabel= new JLabel("OBRAZ DETEKTORA");
	c.gridx = 0;
	c.gridy = 0;
	c.anchor=GridBagConstraints.PAGE_START;
	this.detectorLabel.setFont(this.header);
	this.add(this.detectorLabel,c);

	this.detectorImage = new DetectorImage();
	c.gridy = 1;
	c.insets = new Insets(5,0,5,0);
	this.add(this.detectorImage,c);

}
 
开发者ID:Tosbert,项目名称:FizeauExperimentSimulation,代码行数:20,代码来源:DetectorPanel.java

示例2: createSeparator

import java.awt.GridBagLayout; //导入依赖的package包/类
public static JPanel createSeparator(String message) {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;

    c.insets = new Insets(LARGE_SIZE, 0, LARGE_SIZE, 0);
    panel.add(createLabel(message), c);

    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(LARGE_SIZE, LARGE_SIZE, LARGE_SIZE, 0);
    panel.add(new JSeparator(), c);

    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:UI.java

示例3: PrintPreviewPanel

import java.awt.GridBagLayout; //导入依赖的package包/类
/**
 * Creates a preview panel for the specified {@link PrintableComponent}.
 *
 * @param comp
 *            the {@link PrintableComponent} the preview panel should be created for.
 */
public PrintPreviewPanel(PrintableComponent comp, PageFormat pageFormat) {
	this.printer = new ComponentPrinter(comp);
	this.cardLayout = new CardLayout();
	this.pageFormat = pageFormat;
	setLayout(cardLayout);

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.weightx = 1;
	gbc.weighty = 1;
	gbc.fill = GridBagConstraints.NONE;
	gbc.anchor = GridBagConstraints.CENTER;

	landscapePanel = new JPanel(new GridBagLayout());
	landscapePreview = new ComponentPreviewPanel(Orientation.LANDSCAPE);
	landscapePanel.add(landscapePreview, gbc);
	add(landscapePanel, Orientation.LANDSCAPE.toString());

	portraitPanel = new JPanel(new GridBagLayout());
	portraitPreview = new ComponentPreviewPanel(Orientation.PORTRAIT);
	portraitPanel.add(portraitPreview, gbc);
	add(portraitPanel, Orientation.PORTRAIT.toString());

	// set page format
	setPageFormat(pageFormat);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:32,代码来源:PrintPreviewPanel.java

示例4: initialize

import java.awt.GridBagLayout; //导入依赖的package包/类
/**
 * This method initializes this
 */
private void initialize() {
	GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
	gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
	gridBagConstraints1.gridy = 1;
	gridBagConstraints1.weightx = 1.0;
	gridBagConstraints1.insets = new Insets(2, 2, 2, 2);
	gridBagConstraints1.gridx = 0;
	
	GridBagConstraints gridBagConstraints = new GridBagConstraints();
	gridBagConstraints.gridx = 0;
	gridBagConstraints.insets = new Insets(2, 2, 2, 2);
	gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
	gridBagConstraints.gridy = 2;

	GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
	gridBagConstraints2.gridx = 0;
	gridBagConstraints2.insets = new Insets(2, 2, 2, 2);
	gridBagConstraints2.fill = GridBagConstraints.VERTICAL;
	gridBagConstraints2.gridy = 3;

	this.setLayout(new GridBagLayout());
       this.add(getExecuteButton(), gridBagConstraints1);
       this.add(new JLabel("Node query:"), gridBagConstraints);
       this.add(getQueryField(), gridBagConstraints2);
	}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:29,代码来源:DBQueryPanel.java

示例5: addLeftRightComponents

import java.awt.GridBagLayout; //导入依赖的package包/类
private void addLeftRightComponents(JComponent[] ComponentLeft,
		JComponent[] ComponentRight,
           GridBagLayout gridbag,
           Container container) {
	
		GridBagConstraints c = new GridBagConstraints();
		c.anchor = GridBagConstraints.NORTHEAST;
		int numLabels = ComponentLeft.length;

		for (int i = 0; i < numLabels; i++) {
			c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
			c.fill = GridBagConstraints.NONE;      //reset to default
			c.weightx = 0.0;   
			c.insets = new Insets(0,10,0,0);//reset to default
			container.add(ComponentLeft[i], c);

			c.gridwidth = GridBagConstraints.REMAINDER;     //end row
			c.fill = GridBagConstraints.HORIZONTAL;
			c.weightx = 0.0;
			c.insets = new Insets(0,10,3,0);
			container.add(ComponentRight[i], c);
		}
}
 
开发者ID:etomica,项目名称:etomica,代码行数:24,代码来源:ViewAlkaneLengthSelection.java

示例6: buildContentLoadingLabel

import java.awt.GridBagLayout; //导入依赖的package包/类
private JComponent buildContentLoadingLabel() {
    JLabel label = new JLabel( BundleSupport.getLabel( "ContentLoading" ) ); // NOI18N
    label.setHorizontalAlignment( JLabel.CENTER );
    label.setVerticalAlignment( JLabel.CENTER );
    label.setOpaque( false );
    Component header = getContentHeader();
    if( null != header ) {
        JPanel panel = new JPanel( new GridBagLayout() );
        panel.setOpaque( false );
        panel.add( header, new GridBagConstraints(0,0,1,1,1.0,1.0,
            GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
        panel.add( label, new GridBagConstraints(0,1,1,1,1.0,1.0,
            GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
        panel.setBorder( BorderFactory.createEmptyBorder(40, 0, 40, 0));
        return panel;
    }
    label.setBorder( BorderFactory.createEmptyBorder(40, 0, 40, 0));
    return label;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:RSSFeed.java

示例7: demoMenu

import java.awt.GridBagLayout; //导入依赖的package包/类
/** Start a menu that allows the user to launch a number of demos for the 
 * JSpikeStack package.  To add a new demo to the menu:
 * 1) Add the appropriate element to the "Demos" enumerator (above);
 * 2) Add the button in demoMenu()
 * 3) Connect the enumerator element to the appropriate function in DemoLauncher through the switch statement.
 */
public static void demoMenu()
{
            
    JFrame frm=new JFrame();
    frm.setTitle("JSpikeStack demos");
    Container pane=frm.getContentPane();
    JButton button;
    
    pane.setLayout(new GridBagLayout());
    
    addDemoButton("Network Generation Demo","Read a network From XML and let it generate",Demos.GENERATE,pane);
    addDemoButton("Learning Demo","Read an AER file, initialize a random net, and run STDP learning",Demos.LEARN,pane);
    addDemoButton("Convolution Demo",  "Here we read data from the Silicon retina.  Two output layers respond to vertically and horizontally oriented features.",Demos.CONV,pane);
    addDemoButton("RC Network",  "Takes retina inputs and fires them to a smoothing network.",Demos.RCNET,pane);
    addDemoButton("Retina",  "In this demo we mimic the behaviour of a variety of types of retinal ganglion cell.",Demos.RETINA,pane);
    
    
    frm.setPreferredSize(new Dimension(500,500));
    frm.pack();
    frm.setVisible(true);
    frm.toFront();
    frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:31,代码来源:JspikeStack.java

示例8: addLink

import java.awt.GridBagLayout; //导入依赖的package包/类
private int addLink( int row, DataObject dob ) {
    Action action = extractAction( dob );
    if( null != action ) {
        JPanel panel = new JPanel( new GridBagLayout() );
        panel.setOpaque(false);
        ActionButton lb = new ActionButton( action, Utils.getUrlString( dob ),
                Utils.getColor( COLOR_BIG_BUTTON ), true, dob.getPrimaryFile().getPath() );
        panel.add( lb, new GridBagConstraints(1,0,1,3,1.0,0.0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(0,0,0,0),0,0) );
        lb.setFont( GET_STARTED_FONT );
        
        lb.getAccessibleContext().setAccessibleName( lb.getText() );
        lb.getAccessibleContext().setAccessibleDescription( 
                BundleSupport.getAccessibilityDescription( "GettingStarted", lb.getText() ) ); //NOI18N
        add( panel, new GridBagConstraints( 0,row++,1,1,1.0,0.0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
            new Insets(0,0,3,0), 0, 0 ) );
    }
    return row;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:GetStarted.java

示例9: GridBagInfoProvider

import java.awt.GridBagLayout; //导入依赖的package包/类
public GridBagInfoProvider(Container container, LayoutSupportManager layoutManager) {
    this.container = container;
    this.layoutManager = layoutManager;
    LayoutManager containerLayout = container.getLayout();
    if (!(containerLayout instanceof GridBagLayout)) {
        throw new IllegalArgumentException();
    }
    try {
        tempXField = GridBagConstraints.class.getDeclaredField("tempX"); // NOI18N
        tempXField.setAccessible(true);
        tempYField = GridBagConstraints.class.getDeclaredField("tempY"); // NOI18N
        tempYField.setAccessible(true);
        tempHeightField = GridBagConstraints.class.getDeclaredField("tempHeight"); // NOI18N
        tempHeightField.setAccessible(true);
        tempWidthField = GridBagConstraints.class.getDeclaredField("tempWidth"); // NOI18N
        tempWidthField.setAccessible(true);
    } catch (NoSuchFieldException nsfex) {
        FormUtils.LOGGER.log(Level.INFO, nsfex.getMessage(), nsfex);
    }
    containerEmphColor = deriveEmphColor(container);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:GridBagInfoProvider.java

示例10: QualityPanel

import java.awt.GridBagLayout; //导入依赖的package包/类
public QualityPanel() {
    super();

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    setLayout(gridbag);
    setBorder(BorderFactory.createTitledBorder(strTitle));

    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weighty = 1.0;

    ButtonGroup bg = new ButtonGroup();
    rbDraft = createRadioButton("radiobutton.draftq", this);
    bg.add(rbDraft);
    addToGB(rbDraft, this, gridbag, c);
    rbNormal = createRadioButton("radiobutton.normalq", this);
    rbNormal.setSelected(true);
    bg.add(rbNormal);
    addToGB(rbNormal, this, gridbag, c);
    rbHigh = createRadioButton("radiobutton.highq", this);
    bg.add(rbHigh);
    addToGB(rbHigh, this, gridbag, c);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:ServiceDialog.java

示例11: LinkButtonValueCellEditor

import java.awt.GridBagLayout; //导入依赖的package包/类
/**
 * Creates either a {@link LinkLocalButton} or a {@link LinkRemoteButton} that executes the
 * action stored in type.
 *
 * @param type
 *            the type
 */
public LinkButtonValueCellEditor(final ParameterTypeLinkButton type) {
	super(new JTextField());
	this.container = new JPanel(new GridBagLayout());
	this.container.setToolTipText(type.getDescription());

	GridBagConstraints gbc = new GridBagConstraints();

	JComponent linkButton;
	if (type.isLocalAction()) {
		linkButton = new LinkLocalButton(type.getAction());
	} else {
		linkButton = new LinkRemoteButton(type.getAction());
	}
	gbc.gridx += 1;
	gbc.weightx = 1;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	container.add(linkButton, gbc);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:LinkButtonValueCellEditor.java

示例12: KuCunPanDian

import java.awt.GridBagLayout; //导入依赖的package包/类
public KuCunPanDian() {
	super();
	setMaximizable(true);
	setIconifiable(true);
	setClosable(true);
	getContentPane().setLayout(new GridBagLayout());
	setTitle("����̵�");
	setBounds(50, 50, 750, 400);

	setupComponet(new JLabel("�� �� Ա��"), 0, 0, 1, 0, false);
	pdy.setFocusable(false);
	pdy.setPreferredSize(new Dimension(120, 21));
	setupComponet(pdy, 1, 0, 1, 0, true);

	setupComponet(new JLabel("�̵�ʱ�䣺"), 2, 0, 1, 0, false);
	pdsj.setFocusable(false);
	pdsj.setText(pdDate.toLocaleString());
	pdsj.setPreferredSize(new Dimension(180, 21));
	setupComponet(pdsj, 3, 0, 1, 1, true);

	setupComponet(new JLabel("Ʒ �� ����"), 4, 0, 1, 0, false);
	pzs.setFocusable(false);
	pzs.setPreferredSize(new Dimension(80, 21));
	setupComponet(pzs, 5, 0, 1, 20, true);

	table = new JTable();
	table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	initTable();

	JScrollPane scrollPanel = new JScrollPane(table);
	scrollPanel.setPreferredSize(new Dimension(700, 300));
	setupComponet(scrollPanel, 0, 2, 6, 1, true);
}
 
开发者ID:Edward7Zhang,项目名称:SuperMarketManageSystem,代码行数:34,代码来源:KuCunPanDian.java

示例13: initComponents

import java.awt.GridBagLayout; //导入依赖的package包/类
private void initComponents(String text, Font font) {
    setBorder(BorderFactory.createEmptyBorder());
    setLayout(new GridBagLayout());
    setOpaque(false);

    label = new JLabel(text);
    label.setForeground(getForeground());
    if (font != null) label.setFont(font);
    else label.setFont(label.getFont().deriveFont(Font.BOLD));
    GridBagConstraints c1 = new GridBagConstraints();
    c1.weighty = 1d;
    add(label, c1);

    GridBagConstraints c2 = new GridBagConstraints();
    c2.weightx = 1d;
    c2.fill = GridBagConstraints.HORIZONTAL;
    c2.insets = new Insets(0, 4, 0, 0);
    add(new Separator(), c2);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SectionSeparator.java

示例14: DrivestrengthMainWindow

import java.awt.GridBagLayout; //导入依赖的package包/类
public DrivestrengthMainWindow() {
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
    }
    setLayout(new GridBagLayout());
    setTitle("ASGDrivestrength");
    setSize(500, 300);

    JSlider percentageEnergySlider = new JSlider(JSlider.HORIZONTAL,
            0, 100, 0);

    JButton runButton = new JButton("Run");
    add(percentageEnergySlider);
    add(runButton);

    setVisible(true);
}
 
开发者ID:hpiasg,项目名称:asgdrivestrength,代码行数:19,代码来源:DrivestrengthMainWindow.java

示例15: ViewModelListener

import java.awt.GridBagLayout; //导入依赖的package包/类
ViewModelListener(
    String viewType,
    JComponent view,
    JComponent buttonsPane,
    String propertiesHelpID,
    Image viewIcon
) {
    this.viewType = viewType;
    this.view = view;
    this.buttonsPane = buttonsPane;
    buttonsPane.setLayout(new GridBagLayout());
    this.propertiesHelpID = propertiesHelpID;
    this.viewIcon = viewIcon;
    initView();
    setUp();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ViewModelListener.java


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