List of usage examples for java.awt Insets Insets
public Insets(int top, int left, int bottom, int right)
From source file:com.sec.ose.osi.ui.frm.main.identification.autoidentify.JPanImportSPDX.java
private JPanel getJPanelOption() { if (jPanelOption == null) { jPanelOption = new JPanel(); jPanelOption.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.gridx = 0;//from w ww . ja v a 2 s . c o m gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(0, 5, 0, 5); jPanelOption.add(getJCheckSamePath(), gridBagConstraints); } return jPanelOption; }
From source file:captureplugin.drivers.defaultdriver.AdditionalParams.java
/** * Create Details-Panel/*w w w .j av a 2 s . c o m*/ * @return Details-Panel */ private JPanel createDetailsPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weighty = 0.5; c.weightx = 1.0; c.insets = new Insets(0, 0, 5, 0); c.fill = GridBagConstraints.BOTH; c.gridwidth = GridBagConstraints.REMAINDER; GridBagConstraints l = new GridBagConstraints(); l.weightx = 1.0; l.insets = new Insets(0, 0, 5, 0); l.fill = GridBagConstraints.HORIZONTAL; l.gridwidth = GridBagConstraints.REMAINDER; panel.add(new JLabel(mLocalizer.msg("Name", "Name")), l); mName = new JTextField(); panel.add(mName, l); panel.add(new JLabel(mLocalizer.msg("Parameter", "Parameter")), l); mParam = new ParamInputField(new CaptureParamLibrary(mConfig), "", false); panel.add(mParam, c); return panel; }
From source file:burp.BurpExtender.java
private JPanel createMainPanel() { JPanel main = new JPanel(); main.setLayout(new GridBagLayout()); // Create Settings Panel JPanel settings = new JPanel(new GridBagLayout()); createTitle("Settings", settings); KeyListener projectEnter = new KeyAdapter() { @Override/*www . j av a2s .c om*/ public void keyPressed(KeyEvent k) { if (k.getKeyCode() == KeyEvent.VK_ENTER) updateProjects(); } }; serverUrl = labelTextField("Server URL: ", settings, callbacks.loadExtensionSetting(BurpExtender.SERVER_KEY)); serverUrl.addKeyListener(projectEnter); serverUrl.addFocusListener(new JTextFieldSettingFocusListener(BurpExtender.SERVER_KEY, callbacks)); apiKey = labelTextField("API Key: ", settings, callbacks.loadExtensionSetting(BurpExtender.API_KEY)); apiKey.addKeyListener(projectEnter); apiKey.addFocusListener(new JTextFieldSettingFocusListener(BurpExtender.API_KEY, callbacks)); JButton targetRefresh = new JButton(); targetRefresh.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateTargets(); } }); targetUrl = createComboBox("Target URL: ", settings, 3, targetRefresh); projectRefresh = new JButton(); projectRefresh.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Thread updateThread = new Thread() { public void run() { NameValuePair selected = getProject(); if (selected != null) callbacks.saveExtensionSetting(BurpExtender.PROJECT_KEY, selected.getValue()); updateProjects(); } }; updateThread.start(); } }); projectBox = createComboBox("Projects: ", settings, 4, projectRefresh); GridBagConstraints setGBC = new GridBagConstraints(); setGBC.gridy = 3; setGBC.anchor = GridBagConstraints.NORTHWEST; main.add(settings, setGBC); // Separator Insets ins = new Insets(10, 10, 2, 10); JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); callbacks.customizeUiComponent(sep); GridBagConstraints sepGBC = new GridBagConstraints(); sepGBC.gridwidth = 3; sepGBC.gridx = 0; sepGBC.fill = GridBagConstraints.HORIZONTAL; sepGBC.insets = ins; main.add(sep, sepGBC); // Create Export Button JButton exportBtn = new JButton(); exportBtn.setText("Send to Code Dx"); exportBtn.addActionListener(new ExportActionListener(this, callbacks)); callbacks.customizeUiComponent(exportBtn); GridBagConstraints btnGBC = new GridBagConstraints(); btnGBC.gridx = 0; btnGBC.weightx = 1.0; btnGBC.weighty = 1.0; btnGBC.insets = ins; btnGBC.anchor = GridBagConstraints.NORTHWEST; main.add(exportBtn, btnGBC); updateTargets(); return main; }
From source file:com.limegroup.gnutella.gui.LicenseWindow.java
protected void createValid() { GridBagConstraints c = new GridBagConstraints(); JComponent label = new JLabel(getDetailsString()); Font f = label.getFont();/*from w ww.j av a 2 s .c o m*/ label.setFont(new Font(f.getName(), Font.BOLD, f.getSize())); c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; DETAILS.add(label, c); JTextArea text = newTextArea(LICENSE.getLicenseDescription(URN)); c.gridwidth = GridBagConstraints.RELATIVE; c.gridheight = 2; c.weighty = 1; c.weightx = .7; c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; DETAILS.add(text, c); if (LICENSE.getLicenseDeed(URN) != null) { label = new URLLabel(LICENSE.getLicenseDeed(URN), getDeedString()); } else { label = new JLabel(); label.setVisible(false); } c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.weighty = 0; c.weightx = .3; c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(0, 0, 3, 0); DETAILS.add(label, c); label = new URLLabel(LICENSE.getLicenseURI(), getVerificationString()); DETAILS.add(label, c); }
From source file:dk.dma.epd.common.prototype.gui.route.RoutePropertiesDialogCommon.java
/** * Initializes the user interface//from w ww . ja v a 2 s. co m */ private void initGui() { Insets insets1 = new Insets(5, 5, 0, 5); Insets insets2 = new Insets(5, 25, 0, 5); Insets insets3 = new Insets(5, 5, 0, 0); Insets insets4 = new Insets(5, 0, 0, 5); Insets insets5 = new Insets(5, 5, 5, 5); Insets insets6 = new Insets(5, 25, 5, 5); Insets insets10 = new Insets(10, 10, 10, 10); JPanel content = new JPanel(new GridBagLayout()); getContentPane().add(content); // ******************************** // ** Route properties panel // ******************************** JPanel routeProps = new JPanel(new GridBagLayout()); routeProps.setBorder(new TitledBorder(new LineBorder(Color.black), "Route Properties")); content.add(routeProps, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets10, 0, 0)); // Auto-completion List<String> strings = new ArrayList<>(); strings.add("Copenhagen"); strings.add("Oslo"); AutoCompleteDecorator.decorate(originTxT, strings, false); AutoCompleteDecorator.decorate(destinationTxT, strings, false); // Column 1 widgets int gridY = 0; nameTxT.setEditable(!readOnlyRoute); nameTxT.getDocument().addDocumentListener(new TextFieldChangeListener(nameTxT)); routeProps.add(new JLabel("Name:"), new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); routeProps.add(fixSize(nameTxT, 120), new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); originTxT.setEditable(!readOnlyRoute); originTxT.getDocument().addDocumentListener(new TextFieldChangeListener(originTxT)); routeProps.add(new JLabel("Origin:"), new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); routeProps.add(fixSize(originTxT, 120), new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); destinationTxT.setEnabled(!readOnlyRoute); destinationTxT.getDocument().addDocumentListener(new TextFieldChangeListener(destinationTxT)); routeProps.add(new JLabel("Destination:"), new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); routeProps.add(fixSize(destinationTxT, 120), new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); distanceTxT.setEditable(false); routeProps.add(new JLabel("Total Distance:"), new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); routeProps.add(fixSize(distanceTxT, 120), new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); // Column 2 widgets gridY = 0; int h = (int) departurePicker.getPreferredSize().getHeight(); initDatePicker(departurePicker, departureSpinner); routeProps.add(new JLabel("Estimated Time of Departure:"), new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0)); routeProps.add(fixSize(departurePicker, 120), new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0)); routeProps.add(fixSize(departureSpinner, 60, h), new GridBagConstraints(4, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0)); initDatePicker(arrivalPicker, arrivalSpinner); routeProps.add(new JLabel("Estimated Time of Arrival:"), new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0)); routeProps.add(fixSize(arrivalPicker, 120), new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0)); routeProps.add(fixSize(arrivalSpinner, 60, h), new GridBagConstraints(4, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0)); inrouteTxT.setEditable(false); routeProps.add(new JLabel("Estimated Time in-route:"), new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0)); routeProps.add(fixSize(inrouteTxT, 180), new GridBagConstraints(3, gridY++, 2, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); etaCalculationTime.setEnabled(!readOnlyRoute); etaCalculationTime.addActionListener(this); routeProps.add(new JLabel("Calculate TTG/ETA using:"), new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets6, 0, 0)); routeProps.add(fixSize(etaCalculationTime, 180), new GridBagConstraints(3, gridY++, 2, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); allSpeeds.setEnabled(!readOnlyRoute); allSpeedsBtn.setEnabled(!readOnlyRoute); routeProps.add(new JLabel("Speed all legs: "), new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0)); routeProps.add(fixSize(allSpeeds, 60), new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0)); routeProps.add(fixSize(allSpeedsBtn, 60, h), new GridBagConstraints(4, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0)); routeProps.add(new JLabel(""), new GridBagConstraints(5, 0, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets2, 0, 0)); // ******************************** // ** Route detail panel // ******************************** routeTableModel = createRouteTableModel(); routeDetailTable = new DeltaTable(routeTableModel, DELTA_START_COL_INDEX); routeDetailTable.setTableFont(routeDetailTable.getTableFont().deriveFont(10.0f)); routeDetailTable.setNonEditableBgColor(UIManager.getColor("Table.background").darker().darker()); routeDetailTable.addListSelectionListener(this); // Set the minimum column widths for (int x = 0; x < COL_MIN_WIDTHS.length; x++) { routeDetailTable.getColumn(x).setMinWidth(COL_MIN_WIDTHS[x]); } // Configure lock column routeDetailTable.fixColumnWidth(0, COL_MIN_WIDTHS[0]); routeDetailTable.getColumn(0).setCellRenderer(new LockTableCell.CustomBooleanCellRenderer()); routeDetailTable.getColumn(0).setCellEditor(new LockTableCell.CustomBooleanCellEditor()); // Configure ETA column routeDetailTable.getColumn(7).setCellEditor(new EtaEditor()); // Configure heading column JComboBox<Heading> headingCombo = new JComboBox<>(Heading.values()); headingCombo.setFont(headingCombo.getFont().deriveFont(10.0f)); routeDetailTable.getColumn(10).setCellEditor(new DefaultCellEditor(headingCombo)); JPanel routeTablePanel = new JPanel(new BorderLayout()); routeTablePanel.add(routeDetailTable, BorderLayout.CENTER); routeTablePanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Route Details")); content.add(routeTablePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, NORTHWEST, BOTH, insets10, 0, 0)); // ******************************** // ** Button panel // ******************************** JPanel btnPanel = new JPanel(new GridBagLayout()); content.add(btnPanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, NORTHWEST, HORIZONTAL, insets10, 0, 0)); btnZoomToRoute.addActionListener(this); btnZoomToWp.addActionListener(this); btnDelete.addActionListener(this); btnActivate.addActionListener(this); btnClose.addActionListener(this); cbVisible.addActionListener(this); allSpeedsBtn.addActionListener(this); getRootPane().setDefaultButton(btnClose); btnPanel.add(btnZoomToRoute, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); btnPanel.add(btnZoomToWp, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); btnPanel.add(btnDelete, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); btnPanel.add(btnActivate, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); btnPanel.add(cbVisible, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); btnPanel.add(btnClose, new GridBagConstraints(5, 0, 1, 1, 1.0, 0.0, EAST, NONE, insets5, 0, 0)); }
From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java
protected JPanel createFlowTypePanel() { JPanel panel = new JPanel(); panel.setOpaque(false);//from w w w . j av a2s . c o m 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:dmh.kuebiko.view.NoteStackFrame.java
/** * Initialize the contents of the frame. The contents of this method was * generated by Window Builder Pro.//ww w. ja va 2s. 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:me.childintime.childintime.ui.window.tool.BmiToolDialog.java
/** * Build the student body states panel.//from w ww. j av a 2 s. com * * @return Student body states panel. */ private JPanel buildUiStudentBodyStatesPanel() { // Create a new grid bag constraints configuration instance GridBagConstraints c = new GridBagConstraints(); // Create the panel final JPanel studentBodyStatePanel = new JPanel(new GridBagLayout()); // Add the label c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 0; c.weightx = 0; c.weighty = 0; c.insets = new Insets(8, 2, 2, 0); c.anchor = GridBagConstraints.SOUTHWEST; studentBodyStatePanel.add(new JLabel("Student's body states:"), c); // Create a list for the students body states this.studentBodyStates = new EntityViewComponent(Core.getInstance().getBodyStateManager()); // Add the list c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 1; c.weightx = 1; c.weighty = 1; c.insets = new Insets(0, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; studentBodyStatePanel.add(this.studentBodyStates, c); // Update the student body state list when the selected student is changed this.studentList.addSelectionChangeListenerListener(this::updateStudentBodyStateList); // Set the minimum preferred size of the body states list this.studentBodyStates.setPreferredSize(new Dimension(200, 100)); // Return the panel return studentBodyStatePanel; }
From source file:edu.harvard.mcz.imagecapture.WhatsThisImageDialog.java
/** * This method initializes jPanel /*from w w w.jav a2 s . co m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.fill = GridBagConstraints.BOTH; gridBagConstraints9.gridy = 4; gridBagConstraints9.weightx = 1.0; gridBagConstraints9.anchor = GridBagConstraints.WEST; gridBagConstraints9.gridx = 1; GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.gridx = 0; gridBagConstraints8.anchor = GridBagConstraints.EAST; gridBagConstraints8.gridy = 4; jLabel4 = new JLabel(); jLabel4.setText("Image Of:"); GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.gridx = 1; gridBagConstraints7.weighty = 1.0; gridBagConstraints7.gridy = 6; GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.gridx = 1; gridBagConstraints6.gridy = 5; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.fill = GridBagConstraints.BOTH; gridBagConstraints5.gridy = 3; gridBagConstraints5.weightx = 1.0; gridBagConstraints5.anchor = GridBagConstraints.WEST; gridBagConstraints5.gridx = 1; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.gridx = 0; gridBagConstraints4.anchor = GridBagConstraints.EAST; gridBagConstraints4.weighty = 0.0; gridBagConstraints4.gridy = 3; jLabel3 = new JLabel(); jLabel3.setText("DrawerNumber:"); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridwidth = 2; gridBagConstraints3.weighty = 0.0; gridBagConstraints3.anchor = GridBagConstraints.NORTH; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.fill = GridBagConstraints.BOTH; gridBagConstraints2.gridy = 2; gridBagConstraints2.weightx = 1.0; gridBagConstraints2.anchor = GridBagConstraints.WEST; gridBagConstraints2.gridx = 1; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.anchor = GridBagConstraints.EAST; gridBagConstraints1.weighty = 0.0; gridBagConstraints1.gridy = 2; jLabel2 = new JLabel(); jLabel2.setText("Barcode:"); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.insets = new Insets(0, 0, 5, 0); gridBagConstraints.weighty = 0.0; gridBagConstraints.gridy = 1; jLabel1 = new JLabel(); jLabel1.setText("Please Identify this Image."); jLabel = new JLabel(); jLabel.setText("No Barcode or drawer number found."); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(jLabel, gridBagConstraints3); jPanel.add(jLabel1, gridBagConstraints); jPanel.add(jLabel2, gridBagConstraints1); jPanel.add(getJTextFieldBarcode(), gridBagConstraints2); jPanel.add(jLabel3, gridBagConstraints4); jPanel.add(getJTextFieldDrawerNumber(), gridBagConstraints5); jPanel.add(getJButton(), gridBagConstraints6); jPanel.add(getJPanel2(), gridBagConstraints7); jPanel.add(jLabel4, gridBagConstraints8); jPanel.add(getJComboBox(), gridBagConstraints9); } return jPanel; }
From source file:org.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java
public JSplitPane renderGroupResult(final ValueCountingAnalyzerResult result) { final Integer distinctCount = result.getDistinctCount(); final Integer unexpectedValueCount = result.getUnexpectedValueCount(); final int totalCount = result.getTotalCount(); _valueCounts = result.getReducedValueFrequencies(_preferredSlices); _valueCounts = moveUniqueToEnd(_valueCounts); for (ValueFrequency valueCount : _valueCounts) { setDataSetValue(valueCount.getName(), valueCount.getCount()); }/*from ww w .j a v a 2s . c om*/ logger.info("Rendering with {} slices", getDataSetItemCount()); drillToOverview(result); // chart for display of the dataset String title = "Value distribution of " + _groupOrColumnName; final JFreeChart chart = ChartFactory.createBarChart(title, "Value", "Count", _dataset, PlotOrientation.HORIZONTAL, true, true, false); List<Title> titles = new ArrayList<Title>(); titles.add(new ShortTextTitle("Total count: " + totalCount)); if (distinctCount != null) { titles.add(new ShortTextTitle("Distinct count: " + distinctCount)); } if (unexpectedValueCount != null) { titles.add(new ShortTextTitle("Unexpected value count: " + unexpectedValueCount)); } chart.setSubtitles(titles); ChartUtils.applyStyles(chart); // code-block for tweaking style and coloring of chart { final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.getDomainAxis().setVisible(false); int colorIndex = 0; for (int i = 0; i < getDataSetItemCount(); i++) { final String key = getDataSetKey(i); final Color color; final String upperCaseKey = key.toUpperCase(); if (_valueColorMap.containsKey(upperCaseKey)) { color = _valueColorMap.get(upperCaseKey); } else { if (i == getDataSetItemCount() - 1) { // the last color should not be the same as the first if (colorIndex == 0) { colorIndex++; } } Color colorCandidate = SLICE_COLORS[colorIndex]; int darkAmount = i / SLICE_COLORS.length; for (int j = 0; j < darkAmount; j++) { colorCandidate = WidgetUtils.slightlyDarker(colorCandidate); } color = colorCandidate; colorIndex++; if (colorIndex >= SLICE_COLORS.length) { colorIndex = 0; } } plot.getRenderer().setSeriesPaint(i, color); } } final ChartPanel chartPanel = ChartUtils.createPanel(chart, false); final DCPanel leftPanel = new DCPanel(); leftPanel.setLayout(new VerticalLayout()); leftPanel.add(WidgetUtils.decorateWithShadow(chartPanel)); _backButton.setMargin(new Insets(0, 0, 0, 0)); _backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { drillToOverview(result); } }); _rightPanel.setLayout(new VerticalLayout()); _rightPanel.add(_backButton); _rightPanel.add(WidgetUtils.decorateWithShadow(_table.toPanel())); final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.setOpaque(false); split.add(leftPanel); split.add(_rightPanel); split.setDividerLocation(550); return split; }