List of usage examples for javax.swing SpringLayout NORTH
String NORTH
To view the source code for javax.swing SpringLayout NORTH.
Click Source Link
From source file:edu.wpi.cs.wpisuitetng.modules.requirementsmanager.view.charts.StatView.java
/** * Builds the side panel with all the options for this StatViw * //from www . j av a 2 s. c om * @return the formatted side panel */ public JPanel buildSidePanel() { final int VERTICAL_PADDING = 5; final int HORIZONTAL_PADDING = 5; final int FAR = 5; final SpringLayout sidePanelLayout = new SpringLayout(); final JPanel sidePanel = new JPanel(sidePanelLayout); final JLabel lblStatisticType = new JLabel("Statistic Type"); final String[] availableStatisticTypes = { "Status", "Assignees", "Iterations", "Velocity" }; // TODO: Add Estimates, Effort, Tasks charts for future use. comboBoxStatisticType = new JComboBox(availableStatisticTypes); comboBoxStatisticType.addActionListener(this); makePieRadio = new JRadioButton("Pie Chart"); makePieRadio.setMnemonic(KeyEvent.VK_P); makePieRadio.setActionCommand("Pie Chart"); makePieRadio.addActionListener(this); makeBarRadio = new JRadioButton("Bar Chart"); makeBarRadio.setMnemonic(KeyEvent.VK_B); makeBarRadio.setActionCommand("Bar Chart"); makeBarRadio.addActionListener(this); makeLineRadio = new JRadioButton("Line Chart"); makeLineRadio.setMnemonic(KeyEvent.VK_B); makeLineRadio.setActionCommand("Line Chart"); makeLineRadio.addActionListener(this); makeLineRadio.setEnabled(false); final ButtonGroup group = new ButtonGroup(); group.add(makePieRadio); group.add(makeBarRadio); group.add(makeLineRadio); updateSelectedItems(); final JPanel radioPanel = new JPanel(new GridLayout(3, 1)); radioPanel.add(makePieRadio); radioPanel.add(makeBarRadio); radioPanel.add(makeLineRadio); radioPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Chart Type")); sidePanel.add(lblStatisticType); sidePanel.add(comboBoxStatisticType); sidePanel.add(radioPanel); sidePanelLayout.putConstraint(SpringLayout.NORTH, lblStatisticType, VERTICAL_PADDING, SpringLayout.NORTH, sidePanel); sidePanelLayout.putConstraint(SpringLayout.WEST, lblStatisticType, HORIZONTAL_PADDING, SpringLayout.WEST, sidePanel); sidePanelLayout.putConstraint(SpringLayout.NORTH, comboBoxStatisticType, VERTICAL_PADDING, SpringLayout.SOUTH, lblStatisticType); sidePanelLayout.putConstraint(SpringLayout.WEST, comboBoxStatisticType, HORIZONTAL_PADDING, SpringLayout.WEST, sidePanel); sidePanelLayout.putConstraint(SpringLayout.NORTH, radioPanel, VERTICAL_PADDING + FAR, SpringLayout.SOUTH, comboBoxStatisticType); sidePanelLayout.putConstraint(SpringLayout.WEST, radioPanel, HORIZONTAL_PADDING, SpringLayout.WEST, sidePanel); return sidePanel; }
From source file:forms.frDados.java
/** * Inicializa o grfico de intensidade de sinal dos satlites. *//*w w w . java 2 s.c om*/ private void initSatGrafico() { dadosGraficoSats.clear(); plot = ChartFactory.createBarChart("Intensidade do sinal", "PRN", "SNR", dadosGraficoSats, PlotOrientation.VERTICAL, false, true, true); plot.getTitle().setFont(Font.decode("arial-16")); plot.getTitle().setPadding(5, 20, 5, 20); plot.setPadding(new RectangleInsets(10, 10, 0, 10)); //plot.setBackgroundPaint(new Color(255,255,255,0)); BarRenderer br = (BarRenderer) plot.getCategoryPlot().getRenderer(); br.setSeriesPaint(0, Color.BLUE); br.setMaximumBarWidth(0.05); plot.getCategoryPlot().getRangeAxis().setRange(new Range(0, 50), true, true); br.setBaseItemLabelsVisible(true); br.setSeriesItemLabelFont(0, Font.decode("arial-12")); br.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); br.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER)); SpringLayout lm = new SpringLayout(); ChartPanel cp = new ChartPanel(plot); cp.setBorder(LineBorder.createGrayLineBorder()); lm.putConstraint(SpringLayout.EAST, pnlSatPlot, 10, SpringLayout.EAST, cp); lm.putConstraint(SpringLayout.WEST, cp, 10, SpringLayout.WEST, pnlSatPlot); lm.putConstraint(SpringLayout.SOUTH, pnlSatPlot, 10, SpringLayout.SOUTH, cp); lm.putConstraint(SpringLayout.NORTH, cp, 10, SpringLayout.NORTH, pnlSatPlot); pnlSatPlot.setLayout(lm); pnlSatPlot.add(cp); }
From source file:org.angnysa.yaba.swing.BudgetFrame.java
private void buildSimulationPanel() { simulationPanel = new JPanel(); SpringLayout springLayout = new SpringLayout(); simulationPanel.setLayout(springLayout); // chart data simulationDataset = new SimulationDataset(service); simulationDataset.setInitial(0D);// w ww . j a va 2 s .c o m simulationDataset.setStart(new LocalDate()); simulationDataset.setEnd(new LocalDate().plus(Years.ONE)); simulationDataset.setPeriod(Period.months(1)); simulationDataset.updateDataset(); transactionModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { simulationDataset.updateDataset(); } }); reconciliationModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { simulationDataset.updateDataset(); } }); // initial amount label JLabel amountLbl = new JLabel(Messages.getString("simulation.field.initial-amount")); //$NON-NLS-1$ springLayout.putConstraint(SpringLayout.WEST, amountLbl, 10, SpringLayout.WEST, simulationPanel); simulationPanel.add(amountLbl); // initial amount field amountFld = new JFormattedTextField( new DefaultFormatterFactory(new NumberFormatter(NumberFormat.getNumberInstance()), new NumberFormatter(NumberFormat.getCurrencyInstance()))); amountFld.setColumns(8); amountFld.setValue(simulationDataset.getInitial()); amountFld.addPropertyChangeListener("value", new PropertyChangeListener() { //$NON-NLS-1$ @Override public void propertyChange(PropertyChangeEvent e) { simulationDataset.setInitial(((Number) amountFld.getValue()).doubleValue()); simulationDataset.updateDataset(); } }); springLayout.putConstraint(SpringLayout.VERTICAL_CENTER, amountLbl, 0, SpringLayout.VERTICAL_CENTER, amountFld); springLayout.putConstraint(SpringLayout.WEST, amountFld, 0, SpringLayout.EAST, amountLbl); springLayout.putConstraint(SpringLayout.NORTH, amountFld, 10, SpringLayout.NORTH, simulationPanel); simulationPanel.add(amountFld); // start date label JLabel fromLbl = new JLabel(Messages.getString("simulation.field.start-date")); //$NON-NLS-1$ springLayout.putConstraint(SpringLayout.WEST, fromLbl, 10, SpringLayout.EAST, amountFld); simulationPanel.add(fromLbl); // start date field fromFld = new JFormattedTextField(new JodaLocalDateFormat()); fromFld.setColumns(8); fromFld.setValue(simulationDataset.getStart()); fromFld.addPropertyChangeListener("value", new PropertyChangeListener() { //$NON-NLS-1$ @Override public void propertyChange(PropertyChangeEvent e) { simulationDataset.setStart((LocalDate) fromFld.getValue()); simulationDataset.updateDataset(); } }); springLayout.putConstraint(SpringLayout.VERTICAL_CENTER, fromLbl, 0, SpringLayout.VERTICAL_CENTER, fromFld); springLayout.putConstraint(SpringLayout.WEST, fromFld, 0, SpringLayout.EAST, fromLbl); springLayout.putConstraint(SpringLayout.NORTH, fromFld, 10, SpringLayout.NORTH, simulationPanel); simulationPanel.add(fromFld); // end date label JLabel toLbl = new JLabel(Messages.getString("simulation.field.end-date")); //$NON-NLS-1$ springLayout.putConstraint(SpringLayout.WEST, toLbl, 10, SpringLayout.EAST, fromFld); simulationPanel.add(toLbl); // end date field toFld = new JFormattedTextField(new JodaLocalDateFormat()); toFld.setColumns(8); toFld.setValue(simulationDataset.getEnd()); toFld.addPropertyChangeListener("value", new PropertyChangeListener() { //$NON-NLS-1$ @Override public void propertyChange(PropertyChangeEvent e) { simulationDataset.setEnd((LocalDate) toFld.getValue()); simulationDataset.updateDataset(); } }); springLayout.putConstraint(SpringLayout.VERTICAL_CENTER, toLbl, 0, SpringLayout.VERTICAL_CENTER, toFld); springLayout.putConstraint(SpringLayout.WEST, toFld, 0, SpringLayout.EAST, toLbl); springLayout.putConstraint(SpringLayout.NORTH, toFld, 10, SpringLayout.NORTH, simulationPanel); simulationPanel.add(toFld); // period label JLabel periodLbl = new JLabel(Messages.getString("simulation.field.period")); //$NON-NLS-1$ springLayout.putConstraint(SpringLayout.WEST, periodLbl, 10, SpringLayout.EAST, toFld); simulationPanel.add(periodLbl); // period field periodFld = new JFormattedTextField(new JodaPeriodFormat()); periodFld.setColumns(5); periodFld.setValue(simulationDataset.getPeriod()); periodFld.addPropertyChangeListener("value", new PropertyChangeListener() { //$NON-NLS-1$ @Override public void propertyChange(PropertyChangeEvent e) { simulationDataset.setPeriod((ReadablePeriod) periodFld.getValue()); simulationDataset.updateDataset(); } }); springLayout.putConstraint(SpringLayout.VERTICAL_CENTER, periodLbl, 0, SpringLayout.VERTICAL_CENTER, periodFld); springLayout.putConstraint(SpringLayout.WEST, periodFld, 0, SpringLayout.EAST, periodLbl); springLayout.putConstraint(SpringLayout.NORTH, periodFld, 10, SpringLayout.NORTH, simulationPanel); simulationPanel.add(periodFld); // chart panel JFreeChart chart = ChartFactory.createLineChart("", Messages.getString("simulation.chart.date-axis-label"), //$NON-NLS-1$//$NON-NLS-2$ Messages.getString("simulation.chart.amount-axis-label"), simulationDataset, //$NON-NLS-1$ PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesFilled(true); renderer.setBaseShapesVisible(true); renderer.setBaseToolTipGenerator(new SimulationTooltipGenerator(service)); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setDismissDelay(3600000); chartPanel.setInitialDelay(0); springLayout.putConstraint(SpringLayout.NORTH, chartPanel, 15, SpringLayout.SOUTH, periodFld); springLayout.putConstraint(SpringLayout.WEST, chartPanel, 10, SpringLayout.WEST, simulationPanel); springLayout.putConstraint(SpringLayout.SOUTH, chartPanel, -10, SpringLayout.SOUTH, simulationPanel); springLayout.putConstraint(SpringLayout.EAST, chartPanel, -10, SpringLayout.EAST, simulationPanel); simulationPanel.add(chartPanel); }
From source file:AppSpringLayout.java
protected void turnCameraOn() { // get default webcam and open it webcam = Webcam.getDefault();//from ww w . jav a 2 s .co m webcam.setViewSize(WebcamResolution.VGA.getSize()); webcam.open(); panel = new WebcamPanel(webcam); panel.setMirrored(true); springLayout.putConstraint(SpringLayout.NORTH, panel, 0, SpringLayout.NORTH, btnTurnCameraOn); springLayout.putConstraint(SpringLayout.WEST, panel, 98, SpringLayout.EAST, originalImageLabel); springLayout.putConstraint(SpringLayout.SOUTH, panel, -430, SpringLayout.SOUTH, lblSafeSearch_1); springLayout.putConstraint(SpringLayout.EAST, panel, 0, SpringLayout.EAST, btnCancel); frame.getContentPane().add(panel); System.out.println("set the camera"); }
From source file:org.eclipse.wb.internal.swing.model.layout.spring.SpringAttachmentInfo.java
/** * Converts {@link IPositionConstants} side into {@link SpringLayout} side. *//*from w ww . j av a2s. c om*/ public static String getSpringSide(int side) { switch (side) { case IPositionConstants.LEFT: return SpringLayout.WEST; case IPositionConstants.TOP: return SpringLayout.NORTH; case IPositionConstants.RIGHT: return SpringLayout.EAST; case IPositionConstants.BOTTOM: return SpringLayout.SOUTH; } throw new IllegalArgumentException(MessageFormat.format("Invalid side: {0}", side)); }
From source file:org.eclipse.wb.internal.swing.model.layout.spring.SpringAttachmentInfo.java
/** * @param side/*from w ww.j a va 2 s . c o m*/ * the side from {@link SpringLayout}. * * @return the absolute framework side one of the {@link IPositionConstants#LEFT}, * {@link IPositionConstants#TOP}, {@link IPositionConstants#RIGHT}, * {@link IPositionConstants#BOTTOM}. */ public static int getFrameworkSide(String side) { if (SpringLayout.WEST.equals(side)) { return IPositionConstants.LEFT; } if (SpringLayout.NORTH.equals(side)) { return IPositionConstants.TOP; } if (SpringLayout.EAST.equals(side)) { return IPositionConstants.RIGHT; } if (SpringLayout.SOUTH.equals(side)) { return IPositionConstants.BOTTOM; } throw new IllegalArgumentException(MessageFormat.format("Invalid side: {0}", side)); }
From source file:pcgen.gui2.converter.panel.WriteDirectoryPanel.java
@Override public void setupDisplay(JPanel panel, final CDOMObject pc) { panel.setLayout(layout);//from www . j a v a2 s. c o m Component label = new JLabel("Please select the Directory where Converted files should be written: "); AbstractButton button = new JButton("Browse..."); button.setMnemonic('r'); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setCurrentDirectory(path.getParentFile()); chooser.setSelectedFile(path); while (true) { int open = chooser.showOpenDialog(null); if (open == JFileChooser.APPROVE_OPTION) { File fileToOpen = chooser.getSelectedFile(); if (fileToOpen.isDirectory() && fileToOpen.canRead() && fileToOpen.canWrite()) { path = fileToOpen; pc.put(ObjectKey.WRITE_DIRECTORY, path); fileLabel.setText(path.getAbsolutePath()); PCGenSettings context = PCGenSettings.getInstance(); context.setProperty(PCGenSettings.CONVERT_OUTPUT_SAVE_PATH, path.getAbsolutePath()); showWarning(); break; } JOptionPane.showMessageDialog(null, "Selection must be a valid " + "(readable & writeable) Directory"); chooser.setCurrentDirectory(path.getParentFile()); } else if (open == JFileChooser.CANCEL_OPTION) { break; } } } }); panel.add(label); panel.add(fileLabel); panel.add(button); panel.add(warningLabel); showWarning(); layout.putConstraint(SpringLayout.NORTH, label, 50, SpringLayout.NORTH, panel); layout.putConstraint(SpringLayout.NORTH, fileLabel, 75 + label.getPreferredSize().height, SpringLayout.NORTH, panel); layout.putConstraint(SpringLayout.NORTH, button, 75 + label.getPreferredSize().height, SpringLayout.NORTH, panel); layout.putConstraint(SpringLayout.WEST, label, 25, SpringLayout.WEST, panel); layout.putConstraint(SpringLayout.WEST, fileLabel, 25, SpringLayout.WEST, panel); layout.putConstraint(SpringLayout.EAST, button, -50, SpringLayout.EAST, panel); layout.putConstraint(SpringLayout.NORTH, warningLabel, 20, SpringLayout.SOUTH, fileLabel); layout.putConstraint(SpringLayout.WEST, warningLabel, 25, SpringLayout.WEST, panel); fileLabel.setText(path.getAbsolutePath()); }