List of usage examples for java.awt GridBagConstraints GridBagConstraints
public GridBagConstraints()
From source file:dmh.kuebiko.view.NoteStackFrame.java
/** * Initialize the contents of the frame. The contents of this method was * generated by Window Builder Pro./*from w w w .j a va2 s. c o m*/ */ private void initialize() { setTitle(buildTitle()); setBounds(100, 100, 450, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 0, 0, 0, 0 }; gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 }; gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE }; gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE }; getContentPane().setLayout(gridBagLayout); horizontalStrut = Box.createHorizontalStrut(20); horizontalStrut.setMinimumSize(new Dimension(3, 0)); horizontalStrut.setPreferredSize(new Dimension(3, 0)); horizontalStrut.setSize(new Dimension(3, 0)); GridBagConstraints gbc_horizontalStrut = new GridBagConstraints(); gbc_horizontalStrut.insets = new Insets(0, 0, 0, 0); gbc_horizontalStrut.gridx = 0; gbc_horizontalStrut.gridy = 0; getContentPane().add(horizontalStrut, gbc_horizontalStrut); GridBagConstraints gbc_stateImageLabel = new GridBagConstraints(); gbc_stateImageLabel.insets = new Insets(0, 0, 0, 0); gbc_stateImageLabel.anchor = GridBagConstraints.EAST; gbc_stateImageLabel.gridx = 1; gbc_stateImageLabel.gridy = 0; stateImageLabel.setBorder(null); stateImageLabel.setHorizontalAlignment(SwingConstants.CENTER); getContentPane().add(stateImageLabel, gbc_stateImageLabel); searchText = new JTextField(); GridBagConstraints gbc_searchText = new GridBagConstraints(); gbc_searchText.insets = new Insets(0, 0, 0, 0); gbc_searchText.fill = GridBagConstraints.HORIZONTAL; gbc_searchText.gridx = 2; gbc_searchText.gridy = 0; getContentPane().add(searchText, gbc_searchText); searchText.setColumns(10); if (SystemUtils.IS_OS_MAC_OSX) { // Make the text field look like the standard Mac OS X search // box control. searchText.putClientProperty("JTextField.variant", "search"); } splitPane = new JSplitPane(); splitPane.setBorder(null); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); GridBagConstraints gbc_splitPane = new GridBagConstraints(); gbc_splitPane.gridwidth = 3; gbc_splitPane.gridheight = 4; gbc_splitPane.insets = new Insets(0, 0, 0, 0); gbc_splitPane.fill = GridBagConstraints.BOTH; gbc_splitPane.gridx = 0; gbc_splitPane.gridy = 1; getContentPane().add(splitPane, gbc_splitPane); notePanel = new NotePanel(); notePanel.getHuxleyUiManager().setOnTextChangeCallback(new Callback<Boolean>() { @Override public void callback(Boolean input) { toggleUnsavedChangeIndicator(input); } }); splitPane.setRightComponent(notePanel); noteTableScroll = new JScrollPane(); noteTableScroll.setMinimumSize(new Dimension(23, 100)); splitPane.setLeftComponent(noteTableScroll); noteTable = newNoteTable(); noteTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); noteTableScroll.setViewportView(noteTable); ActionObserverUtil.registerEnMass(actionMngr, observable, notePanel.getHuxleyUiManager().getTextAction(TextAction.INSERT_DATE)); insertDateMenuItem = new JMenuItem(actionMngr.getAction(InsertDynamicTextAction.class)); insertDateMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.SHIFT_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); textMenu.add(insertDateMenuItem); }
From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java
protected JPanel createFlowTypePanel() { JPanel panel = new JPanel(); panel.setOpaque(false);/* w w w.j a va 2s.c om*/ panel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); panel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(8, 2, 2, 2); gc.weighty = 0; gc.weightx = 1; gc.gridwidth = GridBagConstraints.REMAINDER; gc.gridheight = 1; flowTypeChartPanel = new ChartPanel(null); flowTypeChartPanel.setPreferredSize(new Dimension(80, 60)); panel.add(flowTypeChartPanel, gc); flowNumberLabels = new JLabel[flowTypes.length]; flowNameLabels = new JLabel[flowTypes.length]; gc.fill = GridBagConstraints.BOTH; gc.insets = new Insets(2, 2, 2, 2); for (int i = 0; i < flowTypes.length; i++) { gc.weightx = 1; gc.gridwidth = 1; flowNumberLabels[i] = createNumberLabel(); panel.add(flowNumberLabels[i], gc); gc.weightx = 0; gc.gridwidth = GridBagConstraints.REMAINDER; flowNameLabels[i] = createNameLabel(flowTypes[i].getName()); panel.add(flowNameLabels[i], gc); } return panel; }
From source file:net.sourceforge.processdash.ev.ui.ScheduleBalancingDialog.java
private void addChartToPanel(JPanel panel, int gridY) { // create a dataset for displaying schedule data chartData = new ChartData(); updateChart();/*w w w . ja va2 s . co m*/ // customize a renderer for displaying schedules XYBarRenderer renderer = new XYBarRenderer(); renderer.setUseYInterval(true); renderer.setBaseToolTipGenerator(chartData); renderer.setDrawBarOutline(true); // use an inverted, unadorned numeric Y-axis NumberAxis yAxis = new NumberAxis(); yAxis.setInverted(true); yAxis.setTickLabelsVisible(false); yAxis.setTickMarksVisible(false); yAxis.setUpperMargin(0); // use a Date-based X-axis DateAxis xAxis = new DateAxis(); // create an XY plot to display the data XYPlot plot = new XYPlot(chartData, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeGridlinesVisible(false); plot.setNoDataMessage(TaskScheduleDialog.resources.getString("Chart.No_Data_Message")); // create a chart and a chart panel JFreeChart chart = new JFreeChart(plot); chart.removeLegend(); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setInitialDelay(50); chartPanel.setDismissDelay(60000); chartPanel.setMinimumDrawHeight(40); chartPanel.setMinimumDrawWidth(40); chartPanel.setMaximumDrawHeight(3000); chartPanel.setMaximumDrawWidth(3000); chartPanel.setPreferredSize(new Dimension(300, gridY * 25)); // add the chart to the dialog content pane GridBagConstraints c = new GridBagConstraints(); c.gridy = gridY; c.gridwidth = 4; c.weightx = 2; c.weighty = 1; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(10, 0, 0, 0); panel.add(chartPanel, c); // retrieve the colors used for each chart bar, and register those // colors with the schedule rows so they can act as a legend for (int i = scheduleRows.size(); i-- > 0;) { ScheduleTableRow oneRow = scheduleRows.get(i); oneRow.addColoredIcon(renderer.lookupSeriesPaint(i)); } }
From source file:com.frostwire.gui.bittorrent.PartialFilesDialog.java
private void setupToggleAllSelectionCheckbox() { GridBagConstraints c;// w w w . j a v a2s .c o m _checkBoxToggleAll = new JCheckBox(I18n.tr("Select/Unselect all files"), true); _checkBoxToggleAll.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { onCheckBoxToggleAll(e); } }); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.gridheight = 1; c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(5, 5, 5, 5); panel.add(_checkBoxToggleAll, c); }
From source file:com.choicemaker.cm.modelmaker.gui.panels.HoldVsAccuracyPlotPanel.java
private void layoutPanel() { GridBagLayout layout = new GridBagLayout(); setLayout(layout);//from www . ja v a 2 s .c o m layout.columnWeights = new double[] { 1f, 0f }; layout.columnWidths = new int[] { 200, 300 }; GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 2, 5, 10); //Row 0.......................................................... //histo c.gridy = 0; c.gridx = 0; c.gridwidth = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; ChartPanel p = new ChartPanel(chart, false, false, false, true, true); // p.setHorizontalZoom(true); // p.setVerticalZoom(true); add(p, c); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setDividerSize(2); splitPane.setContinuousLayout(true); splitPane.setDividerLocation(0.5d); splitPane.setResizeWeight(0.5f); splitPane.setOneTouchExpandable(true); splitPane.setTopComponent(accuracyPanel); splitPane.setBottomComponent(hrPanel); c.gridx = 1; c.gridheight = 1; add(splitPane, c); }
From source file:org.gridchem.client.gui.panels.myccg.resource.HPCChartPanel.java
/** * Populate the display area with a multiple rows of graphs representing * the loads on each ComputeBean object within the HashSet. * @param resource//from w w w.j a v a2 s . c om * @param chartType */ private JPanel createChartPanel() { JPanel chartPanel = new JPanel(); if (CURRENT_CHARTTYPE.equals(ChartType.METER) || CURRENT_CHARTTYPE.equals(ChartType.PIE)) { chartPanel.setLayout(new GridLayout(resources.size(), 1)); LoadType[] loadTypes; if (CURRENT_LOADTYPE.equals(LoadType.SUMMARY)) { loadTypes = LoadType.values(); } else { loadTypes = new LoadType[1]; loadTypes[0] = CURRENT_LOADTYPE; } for (ComputeBean resource : resources) { // create a row to insert in the chartPanel JPanel multiChartPanelRow = new JPanel(); multiChartPanelRow.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); // first part is name of the row c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 0; c.fill = GridBagConstraints.NONE; multiChartPanelRow.add(new JLabel(resource.getName())); // chart row will take up the remainder of this panel. c.weightx = 1.0; c.weighty = 1.0; c.gridx = 0; c.gridy = 1; c.fill = GridBagConstraints.BOTH; JPanel chartRow = new JPanel(); chartRow.setLayout(new GridLayout(1, (LoadType.values().length - 1))); for (int i = 0; i < ((loadTypes.length == 1) ? 1 : loadTypes.length - 1); i++) { JFreeChart chart = createChart(resource, CURRENT_CHARTTYPE, loadTypes[i]); ChartPanel cp = new ChartPanel(chart); cp.setPreferredSize(new Dimension(40, 45)); cp.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent event) { // if they double click on the graph, then zoom in on it and // make it the single display in the screen. if (event.getClickCount() == 2) { if (zoomOnSingleChart) { zoomOnSingleChart = false; setChartDisplayType(CURRENT_CHARTTYPE); } else { zoomOnSingleChart = true; removeAll(); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1.0; c.weighty = 1.0; c.gridx = 0; c.gridy = 0; c.fill = GridBagConstraints.BOTH; add((ChartPanel) event.getSource(), c); c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 1; add(createSelectionBar(), c); revalidate(); } } } public void mousePressed(MouseEvent arg0) { } public void mouseReleased(MouseEvent arg0) { } public void mouseEntered(MouseEvent arg0) { } public void mouseExited(MouseEvent arg0) { } }); chartRow.add(cp); } multiChartPanelRow.add(chartRow, c); chartPanel.add(multiChartPanelRow); } } else { chartPanel.setLayout(new GridLayout(1, 1)); JFreeChart chart = createChart(resources, CURRENT_CHARTTYPE, CURRENT_LOADTYPE); ChartPanel cp = new ChartPanel(chart); cp.setPreferredSize(new Dimension(40, 45)); chartPanel.add(cp); } return chartPanel; }
From source file:de.rub.syssec.saaf.gui.editor.FileTree.java
public FileTree(final ApplicationInterface app, File dir, OpenAnalysis open) { super();/*www .j ava 2 s . c o m*/ this.openAna = open; history = new Vector<Vector<String>>(); linkEditorKit = new LinkEditorKit(history, app.getUnpackedDataDir(), this); directory = dir; //userful to debug layout issues //setBackground(Color.MAGENTA); setLayout(new GridBagLayout()); this.model = new EditorModel(app); // we want to be notified if the file changes so we can reflect that in // the tree model.addPropertyChangeListener(this); // the tree that lists the files (top left) JTree tree = new JTree(addNodes(null, dir)); tree.addMouseListener(ma); tree.addTreeSelectionListener(new SelectionListener()); tree.setCellRenderer(new FileCellRenderer()); fileTree = tree; GridBagConstraints treeConstraints = new GridBagConstraints(); treeConstraints.fill = GridBagConstraints.BOTH; treeConstraints.gridheight = 1; treeConstraints.gridwidth = 1; treeConstraints.gridx = 0; treeConstraints.gridy = 0; treeConstraints.weightx = 0.20; treeConstraints.weighty = 1.0; treeConstraints.anchor = GridBagConstraints.FIRST_LINE_START; this.add(new JScrollPane(tree), treeConstraints); // the list of components (bottom left) EntryPointsView entrypoints = new EntryPointsView(model); model.addPropertyChangeListener(entrypoints); JScrollPane entryPointsScroller = new JScrollPane(entrypoints); GridBagConstraints entrypointConstraints = new GridBagConstraints(); entrypointConstraints.anchor = GridBagConstraints.FIRST_LINE_START; entrypointConstraints.fill = GridBagConstraints.BOTH; entrypointConstraints.gridheight = 1; entrypointConstraints.gridwidth = 1; entrypointConstraints.gridx = 0; entrypointConstraints.gridy = 1; entrypointConstraints.weightx = 0.15; entrypointConstraints.weighty = 1.0; this.add(entryPointsScroller, entrypointConstraints); // the editor (contains the textview and the list of methods) this.editor = new EditorView(model, this); this.model.addPropertyChangeListener(this.editor); GridBagConstraints editorConstraints = new GridBagConstraints(); editorConstraints.anchor = GridBagConstraints.NORTHWEST; editorConstraints.fill = GridBagConstraints.BOTH; editorConstraints.gridheight = 2; editorConstraints.gridwidth = 1; editorConstraints.gridx = 1; editorConstraints.gridy = 0; editorConstraints.weightx = 0.70; editorConstraints.weighty = 1.0; this.add(editor, editorConstraints); this.outlineTree = new OutlineView(this.model); model.addPropertyChangeListener("currentClass", outlineTree); GridBagConstraints outlineConstraints = new GridBagConstraints(); outlineConstraints.anchor = GridBagConstraints.NORTHWEST; outlineConstraints.fill = GridBagConstraints.BOTH; outlineConstraints.gridwidth = 1; outlineConstraints.gridheight = 2; outlineConstraints.gridx = 2; outlineConstraints.gridy = 0; outlineConstraints.weightx = 0.15; outlineConstraints.weighty = 1.0; this.add(outlineTree, outlineConstraints); String shortpath = model.getCurrentFile().getAbsolutePath() .replace(app.getApplicationDirectory().getAbsolutePath(), ""); this.setTitle("Editor - " + shortpath); searchNode(shortpath, null); }
From source file:edu.ucla.stat.SOCR.analyses.util.moduls.frm.Panels.Jpan_btn.java
private void getPanel() { this.setLayout(new GridBagLayout()); this.setBorder(BorderFactory.createTitledBorder(Language.getLabel(20))); // File final GridBagConstraints c = new GridBagConstraints(); int gridy = 0; // btn load//from www . j a v a 2 s. c o m c.gridx = 0; c.gridy = gridy; c.gridwidth = 1; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(1, 1, 1, 1); strLoad = Language.getLabel(21); // Load btnLoad = new JButton(strLoad); btnLoad.addActionListener(this); add(btnLoad, c); // btn update c.gridx = 1; c.gridy = gridy; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(1, 1, 1, 1); strUpdate = Language.getLabel(110); // Update btnUpdate = new JButton(strUpdate); btnUpdate.addActionListener(this); btnUpdate.setEnabled(false); add(btnUpdate, c); gridy++; // txt file name c.gridx = 0; c.gridy = gridy; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(1, 1, 1, 1); txtFileName = new JTextField(); txtFileName.setText(Language.getLabel(112)); // No file loaded txtFileName.addActionListener(this); txtFileName.setEditable(false); add(txtFileName, c); gridy++; // progress bar c.gridx = 0; c.gridy = gridy; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(1, 1, 1, 1); progressBar = new JProgressBar(0, 100); progressBar.setStringPainted(true); progressBar.setString(""); progressBar.setBorderPainted(false); progressBar.setValue(0); add(progressBar, c); gridy++; }
From source file:de.cismet.cids.custom.objecteditors.wunda_blau.WebDavPicturePanel.java
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The * content of this method is always regenerated by the Form Editor. */// w w w. j a v a2 s. co m @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { GridBagConstraints gridBagConstraints; bindingGroup = new BindingGroup(); final RoundedPanel pnlFotos = new RoundedPanel(); final SemiRoundedPanel pnlHeaderFotos = new SemiRoundedPanel(); final JLabel lblHeaderFotos = new JLabel(); final JPanel jPanel2 = new JPanel(); final JPanel jPanel1 = new JPanel(); final JScrollPane jspFotoList = new JScrollPane(); lstFotos = new JList(); final JPanel pnlCtrlButtons = new JPanel(); btnAddImg = new JButton(); btnRemoveImg = new JButton(); final JPanel pnlMap = new JPanel(); final RoundedPanel pnlVorschau = new RoundedPanel(); final SemiRoundedPanel semiRoundedPanel2 = new SemiRoundedPanel(); final JLabel lblVorschau = new JLabel(); final JPanel jPanel3 = new JPanel(); pnlFoto = new JPanel(); lblPicture = new JLabel(); lblBusy = new JXBusyLabel(new Dimension(75, 75)); final JPanel pnlCtrlBtn = new JPanel(); btnPrevImg = new JButton(); btnNextImg = new JButton(); final FormListener formListener = new FormListener(); setName("Form"); // NOI18N setOpaque(false); setLayout(new GridBagLayout()); pnlFotos.setMinimumSize(new Dimension(400, 200)); pnlFotos.setName("pnlFotos"); // NOI18N pnlFotos.setPreferredSize(new Dimension(400, 200)); pnlFotos.setLayout(new GridBagLayout()); pnlHeaderFotos.setBackground(new Color(51, 51, 51)); pnlHeaderFotos.setForeground(new Color(51, 51, 51)); pnlHeaderFotos.setName("pnlHeaderFotos"); // NOI18N pnlHeaderFotos.setLayout(new FlowLayout()); lblHeaderFotos.setForeground(new Color(255, 255, 255)); Mnemonics.setLocalizedText(lblHeaderFotos, NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblHeaderFotos.text")); // NOI18N lblHeaderFotos.setName("lblHeaderFotos"); // NOI18N pnlHeaderFotos.add(lblHeaderFotos); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; pnlFotos.add(pnlHeaderFotos, gridBagConstraints); jPanel2.setName("jPanel2"); // NOI18N jPanel2.setOpaque(false); jPanel2.setLayout(new GridBagLayout()); jPanel1.setName("jPanel1"); // NOI18N jPanel1.setOpaque(false); jPanel1.setLayout(new GridBagLayout()); jspFotoList.setMinimumSize(new Dimension(250, 130)); jspFotoList.setName("jspFotoList"); // NOI18N lstFotos.setMinimumSize(new Dimension(250, 130)); lstFotos.setName("lstFotos"); // NOI18N lstFotos.setPreferredSize(new Dimension(250, 130)); final ELProperty eLProperty = ELProperty.create("${cidsBean." + beanCollProp + "}"); final JListBinding jListBinding = SwingBindings.createJListBinding(AutoBinding.UpdateStrategy.READ_WRITE, this, eLProperty, lstFotos); bindingGroup.addBinding(jListBinding); lstFotos.addListSelectionListener(formListener); jspFotoList.setViewportView(lstFotos); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel1.add(jspFotoList, gridBagConstraints); pnlCtrlButtons.setName("pnlCtrlButtons"); // NOI18N pnlCtrlButtons.setOpaque(false); pnlCtrlButtons.setLayout(new GridBagLayout()); btnAddImg.setIcon(new ImageIcon( getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_add_mini.png"))); // NOI18N Mnemonics.setLocalizedText(btnAddImg, NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnAddImg.text")); // NOI18N btnAddImg.setBorderPainted(false); btnAddImg.setContentAreaFilled(false); btnAddImg.setName("btnAddImg"); // NOI18N btnAddImg.addActionListener(formListener); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(0, 0, 5, 0); pnlCtrlButtons.add(btnAddImg, gridBagConstraints); btnRemoveImg.setIcon(new ImageIcon( getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_remove_mini.png"))); // NOI18N Mnemonics.setLocalizedText(btnRemoveImg, NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnRemoveImg.text")); // NOI18N btnRemoveImg.setBorderPainted(false); btnRemoveImg.setContentAreaFilled(false); btnRemoveImg.setName("btnRemoveImg"); // NOI18N btnRemoveImg.addActionListener(formListener); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = 1; gridBagConstraints.insets = new Insets(5, 0, 0, 0); pnlCtrlButtons.add(btnRemoveImg, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.insets = new Insets(0, 5, 0, 0); jPanel1.add(pnlCtrlButtons, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(10, 10, 10, 0); jPanel2.add(jPanel1, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(0, 0, 2, 0); pnlFotos.add(jPanel2, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.insets = new Insets(0, 0, 5, 5); add(pnlFotos, gridBagConstraints); pnlMap.setBorder(BorderFactory.createEtchedBorder()); pnlMap.setMinimumSize(new Dimension(400, 200)); pnlMap.setName("pnlMap"); // NOI18N pnlMap.setPreferredSize(new Dimension(400, 200)); pnlMap.setLayout(new BorderLayout()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(5, 0, 0, 5); add(pnlMap, gridBagConstraints); pnlMap.add(map, BorderLayout.CENTER); pnlVorschau.setName("pnlVorschau"); // NOI18N pnlVorschau.setLayout(new GridBagLayout()); semiRoundedPanel2.setBackground(new Color(51, 51, 51)); semiRoundedPanel2.setName("semiRoundedPanel2"); // NOI18N semiRoundedPanel2.setLayout(new FlowLayout()); lblVorschau.setForeground(new Color(255, 255, 255)); Mnemonics.setLocalizedText(lblVorschau, NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblVorschau.text")); // NOI18N lblVorschau.setName("lblVorschau"); // NOI18N semiRoundedPanel2.add(lblVorschau); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; pnlVorschau.add(semiRoundedPanel2, gridBagConstraints); jPanel3.setName("jPanel3"); // NOI18N jPanel3.setOpaque(false); jPanel3.setLayout(new GridBagLayout()); pnlFoto.setName("pnlFoto"); // NOI18N pnlFoto.setOpaque(false); pnlFoto.setLayout(new GridBagLayout()); lblPicture.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(lblPicture, NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblPicture.text")); // NOI18N lblPicture.setName("lblPicture"); // NOI18N gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; pnlFoto.add(lblPicture, gridBagConstraints); lblBusy.setHorizontalAlignment(SwingConstants.CENTER); lblBusy.setMaximumSize(new Dimension(140, 40)); lblBusy.setMinimumSize(new Dimension(140, 60)); lblBusy.setName("lblBusy"); // NOI18N lblBusy.setPreferredSize(new Dimension(140, 60)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; pnlFoto.add(lblBusy, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(10, 10, 0, 10); jPanel3.add(pnlFoto, gridBagConstraints); pnlCtrlBtn.setName("pnlCtrlBtn"); // NOI18N pnlCtrlBtn.setOpaque(false); pnlCtrlBtn.setPreferredSize(new Dimension(100, 50)); pnlCtrlBtn.setLayout(new GridBagLayout()); btnPrevImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-left.png"))); // NOI18N Mnemonics.setLocalizedText(btnPrevImg, NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnPrevImg.text")); // NOI18N btnPrevImg.setBorderPainted(false); btnPrevImg.setFocusPainted(false); btnPrevImg.setName("btnPrevImg"); // NOI18N btnPrevImg.addActionListener(formListener); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; pnlCtrlBtn.add(btnPrevImg, gridBagConstraints); btnNextImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-right.png"))); // NOI18N Mnemonics.setLocalizedText(btnNextImg, NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnNextImg.text")); // NOI18N btnNextImg.setBorderPainted(false); btnNextImg.setFocusPainted(false); btnNextImg.setName("btnNextImg"); // NOI18N btnNextImg.addActionListener(formListener); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; pnlCtrlBtn.add(btnNextImg, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.insets = new Insets(0, 10, 10, 10); jPanel3.add(pnlCtrlBtn, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; pnlVorschau.add(jPanel3, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(0, 5, 0, 0); add(pnlVorschau, gridBagConstraints); bindingGroup.bind(); }
From source file:SplineAnim.java
private void createCanvasPanel(Panel p) { GridBagLayout gl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); p.setLayout(gl);/* ww w. j ava 2 s .co m*/ gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 5; gbc.gridheight = 5; GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); canvas = new Canvas3D(config); canvas.setSize(490, 490); p.add(canvas, gbc); }