List of usage examples for javax.swing BoxLayout Y_AXIS
int Y_AXIS
To view the source code for javax.swing BoxLayout Y_AXIS.
Click Source Link
From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java
/** * Helper factory method for creating a vertical box layout {@link JPanel}. * * @return the created panel//w ww . j a va 2 s . c o m */ protected JPanel createVerticalPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); return panel; }
From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java
/** * This method initializes jPanel1//from w w w . ja v a 2 s. c o m * * @return javax.swing.JPanel */ private JPanel getJPanel1() { if (jPanel1 == null) { jPanel1 = new JPanel(); jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.X_AXIS)); jPanel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel intermediaryPanel = new JPanel(); intermediaryPanel.setLayout(new BoxLayout(intermediaryPanel, BoxLayout.Y_AXIS)); nodesTable = new JTable(); nodesModel = new ClusterNodesSummaryModel(); nodesTable.setModel(nodesModel); JLabel nodesTableTitle = new JLabel("Nodes status"); nodesTableTitle.setAlignmentX(JLabel.CENTER_ALIGNMENT); nodesTableTitle.setFont(new Font("Dialog", Font.BOLD, 14)); intermediaryPanel.add(Box.createVerticalStrut(5)); intermediaryPanel.add(nodesTableTitle); intermediaryPanel.add(Box.createVerticalStrut(10)); intermediaryPanel.add(nodesTable.getTableHeader()); intermediaryPanel.add(nodesTable); intermediaryPanel.add(Box.createVerticalStrut(10)); intermediaryPanel.add(new JSeparator(JSeparator.HORIZONTAL)); jPanel1.add(Box.createHorizontalGlue()); jPanel1.add(intermediaryPanel); jPanel1.add(Box.createHorizontalGlue()); LoggingManager.log(Level.FINER, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "getJPanel1", "Cluster nodes summary table added"); } return jPanel1; }
From source file:edu.ucla.stat.SOCR.applications.demo.BinomialTradingApplication.java
void initJGraphPanel() { jgraphPanel = new JPanel(); jgraphPanel.setLayout(new BoxLayout(jgraphPanel, BoxLayout.Y_AXIS)); // This method defines the Graph structure as an empty Graph object GraphModel model = new DefaultGraphModel(); jgraph = new JGraph(model); jgraphPanel.add(jgraph);/*from w w w . ja v a2 s.c o m*/ jgraphPanel.validate(); }
From source file:edu.ucla.stat.SOCR.applications.demo.PortfolioApplication2.java
protected void setMixPanel() { sliderPanel2.removeAll();/*w w w . j ava 2 s. co m*/ graphPanel2.removeAll(); graphPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3)); graphPanel2.setLayout(new BoxLayout(graphPanel2, BoxLayout.Y_AXIS)); if (chartPanel != null) graphPanel2.add(chartPanel); /*if (legendPanelOn){ if (legendPanel !=null) legendPanel.setPreferredSize(new Dimension(CHART_SIZE_X*2/3,CHART_SIZE_Y*2/5)); JScrollPane legendPane = new JScrollPane(legendPanel); legendPane.setPreferredSize(new Dimension(CHART_SIZE_X*2/3,CHART_SIZE_Y*2/5)); graphPanel2.add(legendPane); }*/ graphPanel2.validate(); sliderPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3)); sliderPanel2.add(new JLabel(" ")); JScrollPane dt = new JScrollPane(sliderPanel); dt.setPreferredSize(new Dimension(CHART_SIZE_X * 3 / 2, CHART_SIZE_Y)); sliderPanel2.add(dt); /*JScrollPane st = new JScrollPane(summaryPanel); st.setPreferredSize(new Dimension(CHART_SIZE_X/3,CHART_SIZE_Y/6)); sliderPanel2.add(st); st.validate(); sliderPanel2.add(new JLabel(" ")); sliderPanel2.add(new JLabel("Mapping")); mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X/3, CHART_SIZE_Y/2)); sliderPanel2.add(mapPanel);*/ sliderPanel2.validate(); mixPanel.removeAll(); mixPanel.add(graphPanel2, BorderLayout.WEST); mixPanel.add(new JScrollPane(sliderPanel2), BorderLayout.CENTER); mixPanel.validate(); }
From source file:logdruid.ui.chart.GraphPanel.java
public void load(JPanel panel_2) { startDateJSpinner = (JSpinner) panel_2.getComponent(2); endDateJSPinner = (JSpinner) panel_2.getComponent(3); // scrollPane.setV panel.removeAll();// www.j a v a 2 s . c o m Dimension panelSize = this.getSize(); add(scrollPane, BorderLayout.CENTER); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); // scrollPane.set trying to replace scroll where it was JCheckBox relativeCheckBox = (JCheckBox) panel_2.getComponent(5); estimatedTime = System.currentTimeMillis() - startTime; logger.info("gathering time: " + estimatedTime); startTime = System.currentTimeMillis(); // Map<Source, Map<String, MineResult>> Map<Source, Map<String, MineResult>> treeMap = new TreeMap<Source, Map<String, MineResult>>( mineResultSet.mineResults); Iterator mineResultSetIterator = treeMap.entrySet().iterator(); int ite = 0; logger.debug("mineResultSet size: " + mineResultSet.mineResults.size()); while (mineResultSetIterator.hasNext()) { final Map.Entry pairs = (Map.Entry) mineResultSetIterator.next(); logger.debug("mineResultSet key/source: " + ((Source) pairs.getKey()).getSourceName()); JCheckBox checkBox = (JCheckBox) panel_1.getComponent(ite++); logger.debug("checkbox: " + checkBox.getText() + ", " + checkBox.isSelected()); if (checkBox.isSelected()) { Map mrArrayList = (Map<String, MineResult>) pairs.getValue(); ArrayList<String> mineResultGroup = new ArrayList<String>(); Set<String> mrss = mrArrayList.keySet(); mineResultGroup.addAll(mrss); Collections.sort(mineResultGroup, new AlphanumComparator()); Iterator mrArrayListIterator = mineResultGroup.iterator(); while (mrArrayListIterator.hasNext()) { String key = (String) mrArrayListIterator.next(); logger.debug(key); final MineResult mr = (MineResult) mrArrayList.get(key); Map<String, ExtendedTimeSeries> statMap = mr.getStatTimeseriesMap(); Map<String, ExtendedTimeSeries> eventMap = mr.getEventTimeseriesMap(); // logger.info("mineResultSet hash size: " // +mr.getTimeseriesMap().size()); // logger.info("mineResultSet hash content: " + // mr.getStatTimeseriesMap()); logger.debug("mineResultSet mr.getStartDate(): " + mr.getStartDate() + " mineResultSet mr.getEndDate(): " + mr.getEndDate()); logger.debug("mineResultSet (Date)jsp.getValue(): " + (Date) startDateJSpinner.getValue()); logger.debug("mineResultSet (Date)jsp2.getValue(): " + (Date) endDateJSPinner.getValue()); if (mr.getStartDate() != null && mr.getEndDate() != null) { if ((mr.getStartDate().before((Date) endDateJSPinner.getValue())) && (mr.getEndDate().after((Date) startDateJSpinner.getValue()))) { ArrayList<String> mineResultGroup2 = new ArrayList<String>(); Set<String> mrss2 = statMap.keySet(); mineResultGroup2.addAll(mrss2); Collections.sort(mineResultGroup2, new AlphanumComparator()); Iterator statMapIterator = mineResultGroup2.iterator(); // Iterator statMapIterator = statMap.entrySet().iterator(); if (!statMap.entrySet().isEmpty() || !eventMap.entrySet().isEmpty()) { JPanel checkboxPanel = new JPanel(new WrapLayout()); checkboxPanel.setBackground(Color.white); int count = 1; chart = ChartFactory.createXYAreaChart(// Title mr.getSourceID() + " " + mr.getGroup(), // + null, // X-Axis // label null, // Y-Axis label null, // Dataset PlotOrientation.VERTICAL, false, // Show // legend true, // tooltips false // url ); TextTitle my_Chart_title = new TextTitle(mr.getSourceID() + " " + mr.getGroup(), new Font("Verdana", Font.BOLD, 17)); chart.setTitle(my_Chart_title); XYPlot plot = (XYPlot) chart.getPlot(); ValueAxis range = plot.getRangeAxis(); range.setVisible(false); final DateAxis domainAxis1 = new DateAxis(); domainAxis1.setTickLabelsVisible(true); // domainAxis1.setTickMarksVisible(true); logger.debug("getRange: " + domainAxis1.getRange()); if (relativeCheckBox.isSelected()) { domainAxis1.setRange((Date) startDateJSpinner.getValue(), (Date) endDateJSPinner.getValue()); } else { Date startDate = mr.getStartDate(); Date endDate = mr.getEndDate(); if (mr.getStartDate().before((Date) startDateJSpinner.getValue())) { startDate = (Date) startDateJSpinner.getValue(); logger.debug("setMinimumDate: " + (Date) startDateJSpinner.getValue()); } if (mr.getEndDate().after((Date) endDateJSPinner.getValue())) { endDate = (Date) endDateJSPinner.getValue(); logger.debug("setMaximumDate: " + (Date) endDateJSPinner.getValue()); } if (startDate.before(endDate)) { domainAxis1.setRange(startDate, endDate); } } XYToolTipGenerator tt1 = new XYToolTipGenerator() { public String generateToolTip(XYDataset dataset, int series, int item) { StringBuffer sb = new StringBuffer(); String htmlStr = "<html>"; Number x; FastDateFormat sdf = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss"); x = dataset.getX(series, item); sb.append(htmlStr); if (x != null) { sb.append("<p style='color:#000000;'>" + (sdf.format(x)) + "</p>"); sb.append("<p style='color:#000000;'>" + dataset.getSeriesKey(series).toString() + ": " + form.format(dataset.getYValue(0, item)) + "</p>"); if (mr.getFileLineForDate(new Date(x.longValue()), dataset.getSeriesKey(series).toString()) != null) { sb.append( "<p style='color:#0000FF;'>" + cd.sourceFileArrayListMap .get(pairs.getKey()).get(mr .getFileLineForDate( new Date(x.longValue()), dataset.getSeriesKey(series) .toString()) .getFileId()) .getFile().getName() + ":" + mr.getFileLineForDate(new Date(x.longValue()), dataset.getSeriesKey(series).toString()) .getLineNumber() + "</p>"); } } return sb.toString(); } }; while (statMapIterator.hasNext()) { TimeSeriesCollection dataset = new TimeSeriesCollection(); String me = (String) statMapIterator.next(); ExtendedTimeSeries ts = (ExtendedTimeSeries) statMap.get(me); // logger.info(((TimeSeries) // me.getValue()).getMaxY()); if (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY() > 0) dataset.addSeries(ts.getTimeSeries()); logger.debug("mineResultSet group: " + mr.getGroup() + ", key: " + me + " nb records: " + ((ExtendedTimeSeries) statMap.get(me)) .getTimeSeries().getItemCount()); logger.debug("(((TimeSeries) me.getValue()).getMaxY(): " + (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY())); logger.debug("(((TimeSeries) me.getValue()).getMinY(): " + (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMinY())); XYPlot plot1 = chart.getXYPlot(); // LogarithmicAxis axis4 = new LogarithmicAxis(me.toString()); NumberAxis axis4 = new NumberAxis(me.toString()); axis4.setAutoRange(true); axis4.setAxisLineVisible(true); axis4.setAutoRangeIncludesZero(false); plot1.setDomainCrosshairVisible(true); plot1.setRangeCrosshairVisible(true); axis4.setRange(new Range( ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMinY(), ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY())); axis4.setLabelPaint(colors[count]); axis4.setTickLabelPaint(colors[count]); plot1.setRangeAxis(count, axis4); final ValueAxis domainAxis = domainAxis1; domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot1.setDomainAxis(domainAxis); plot1.setForegroundAlpha(0.5f); plot1.setDataset(count, dataset); plot1.mapDatasetToRangeAxis(count, count); final XYAreaRenderer renderer = new XYAreaRenderer(); // XYAreaRenderer2 // also // nice if ((((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY() - ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries() .getMinY()) > 0) { // renderer.setToolTipGenerator(new // StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,new // FastDateFormat("d-MMM-yyyy HH:mm:ss"), // new DecimalFormat("#,##0.00"))); } renderer.setSeriesPaint(0, colors[count]); renderer.setSeriesVisible(0, true); renderer.setSeriesToolTipGenerator(0, tt1); plot1.setRenderer(count, renderer); int hits = 0; // ts.getStat()[1] int matchs = 0; if (((ExtendedTimeSeries) statMap.get(me)).getStat() != null) { hits = ((ExtendedTimeSeries) statMap.get(me)).getStat()[1]; // matchs= ((ExtendedTimeSeries) statMap.get(me)).getStat()[0]; } JCheckBox jcb = new JCheckBox(new VisibleAction(panel, checkboxPanel, axis4, me.toString() + "(" + hits + ")", 0)); Boolean selected = true; jcb.setSelected(true); jcb.setBackground(Color.white); jcb.setBorderPainted(true); jcb.setBorder(BorderFactory.createLineBorder(colors[count], 1, true)); jcb.setFont(new Font("Sans-serif", oldSmallFont.getStyle(), oldSmallFont.getSize())); checkboxPanel.add(jcb); count++; } Iterator eventMapIterator = eventMap.entrySet().iterator(); while (eventMapIterator.hasNext()) { // HistogramDataset histoDataSet=new HistogramDataset(); TimeSeriesCollection dataset = new TimeSeriesCollection(); Map.Entry me = (Map.Entry) eventMapIterator.next(); // if (dataset.getEndXValue(series, item)) if (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMaxY() > 0) dataset.addSeries(((ExtendedTimeSeries) me.getValue()).getTimeSeries()); logger.debug("mineResultSet group: " + mr.getGroup() + ", key: " + me.getKey() + " nb records: " + ((ExtendedTimeSeries) me.getValue()).getTimeSeries().getItemCount()); logger.debug("mineResultSet hash content: " + mr.getEventTimeseriesMap()); logger.debug("(((TimeSeries) me.getValue()).getMaxY(): " + (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMaxY())); logger.debug("(((TimeSeries) me.getValue()).getMinY(): " + (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMinY())); XYPlot plot2 = chart.getXYPlot(); // LogarithmicAxis axis4 = new LogarithmicAxis(me.toString()); NumberAxis axis4 = new NumberAxis(me.getKey().toString()); axis4.setAutoRange(true); // axis4.setInverted(true); axis4.setAxisLineVisible(true); axis4.setAutoRangeIncludesZero(true); // axis4.setRange(new Range(((TimeSeries) // axis4.setRange(new Range(((TimeSeries) // me.getValue()).getMinY(), ((TimeSeries) // me.getValue()).getMaxY())); axis4.setLabelPaint(colors[count]); axis4.setTickLabelPaint(colors[count]); plot2.setRangeAxis(count, axis4); final ValueAxis domainAxis = domainAxis1; // domainAxis.setLowerMargin(0.001); // domainAxis.setUpperMargin(0.0); plot2.setDomainCrosshairVisible(true); plot2.setRangeCrosshairVisible(true); //plot2.setRangeCrosshairLockedOnData(true); plot2.setDomainAxis(domainAxis); plot2.setForegroundAlpha(0.5f); plot2.setDataset(count, dataset); plot2.mapDatasetToRangeAxis(count, count); XYBarRenderer rend = new XYBarRenderer(); // XYErrorRenderer rend.setShadowVisible(false); rend.setDrawBarOutline(true); Stroke stroke = new BasicStroke(5); rend.setBaseStroke(stroke); final XYItemRenderer renderer = rend; renderer.setSeriesToolTipGenerator(0, tt1); // renderer.setItemLabelsVisible(true); renderer.setSeriesPaint(0, colors[count]); renderer.setSeriesVisible(0, true); plot2.setRenderer(count, renderer); int hits = 0; int matchs = 0; if (((ExtendedTimeSeries) me.getValue()).getStat() != null) { hits = ((ExtendedTimeSeries) me.getValue()).getStat()[1]; // matchs= ((ExtendedTimeSeries) me.getValue()).getStat()[0]; } JCheckBox jcb = new JCheckBox(new VisibleAction(panel, checkboxPanel, axis4, me.getKey().toString() + "(" + hits + ")", 0)); jcb.setSelected(true); jcb.setBackground(Color.white); jcb.setBorderPainted(true); jcb.setBorder(BorderFactory.createLineBorder(colors[count], 1, true)); jcb.setFont(new Font("Sans-serif", oldSmallFont.getStyle(), oldSmallFont.getSize())); checkboxPanel.add(jcb); count++; } JPanel pan = new JPanel(); pan.setLayout(new BorderLayout()); pan.setPreferredSize(new Dimension(600, Integer.parseInt((String) Preferences.getPreference("chartSize")))); // pan.setPreferredSize(panelSize); panel.add(pan); final ChartPanel cpanel = new ChartPanel(chart); cpanel.setMinimumDrawWidth(0); cpanel.setMinimumDrawHeight(0); cpanel.setMaximumDrawWidth(1920); cpanel.setMaximumDrawHeight(1200); // cpanel.setInitialDelay(0); cpanel.setDismissDelay(9999999); cpanel.setInitialDelay(50); cpanel.setReshowDelay(200); cpanel.setPreferredSize(new Dimension(600, 350)); // cpanel.restoreAutoBounds(); fix the tooltip // missing problem but then relative display is // broken panel.add(new JSeparator(SwingConstants.HORIZONTAL)); pan.add(cpanel, BorderLayout.CENTER); // checkboxPanel.setPreferredSize(new Dimension(600, // 0)); cpanel.addChartMouseListener(new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent chartmouseevent) { // chartmouseevent.getEntity(). ChartEntity entity = chartmouseevent.getEntity(); if (entity instanceof XYItemEntity) { XYItemEntity item = ((XYItemEntity) entity); if (item.getDataset() instanceof TimeSeriesCollection) { TimeSeriesCollection data = (TimeSeriesCollection) item .getDataset(); TimeSeries series = data.getSeries(item.getSeriesIndex()); TimeSeriesDataItem dataitem = series.getDataItem(item.getItem()); // logger.info(" Serie: "+series.getKey().toString() // + // " Period : "+dataitem.getPeriod().toString()); // mr.getFileForDate(new Date // (x.longValue()) ; int x = chartmouseevent.getTrigger().getX(); // logger.info(mr.getFileForDate(dataitem.getPeriod().getEnd())); int y = chartmouseevent.getTrigger().getY(); String myString = ""; if (dataitem.getPeriod() != null) { logger.info(dataitem.getPeriod().getEnd()); // myString = mr.getFileForDate(dataitem.getPeriod().getEnd()).toString(); String lineString = "" + mr.getFileLineForDate(dataitem.getPeriod().getEnd(), item.getDataset() .getSeriesKey(item.getSeriesIndex()) .toString()) .getLineNumber(); String fileString = cd.sourceFileArrayListMap .get(pairs.getKey()) .get(mr.getFileLineForDate( dataitem.getPeriod().getEnd(), item.getDataset() .getSeriesKey(item.getSeriesIndex()) .toString()) .getFileId()) .getFile().getAbsolutePath(); String command = Preferences.getPreference("editorCommand"); command = command.replace("$line", lineString); command = command.replace("$file", fileString); logger.info(command); Runtime rt = Runtime.getRuntime(); try { rt.exec(command); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } StringSelection stringSelection = new StringSelection( fileString); Clipboard clpbrd = Toolkit.getDefaultToolkit() .getSystemClipboard(); clpbrd.setContents(stringSelection, null); // cpanel.getGraphics().drawString("file name copied", x - 5, y - 5); try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch // block e.printStackTrace(); } } // logger.info(mr.getFileForDate(dataitem.getPeriod().getStart())); } } } public void chartMouseMoved(ChartMouseEvent e) { } }); pan.add(checkboxPanel, BorderLayout.SOUTH); } } } else { logger.debug("mr dates null: " + mr.getGroup() + mr.getSourceID() + mr.getLogFiles()); } } } } // Map=miner.mine(sourceFiles,repo); estimatedTime = System.currentTimeMillis() - startTime; revalidate(); logger.info("display time: " + estimatedTime); }
From source file:mendeley2kindle.MainUIFrame.java
public MainUIFrame(Properties config, Mendeley2Kindle core) { super("Mendeley2Kindle"); setDefaultCloseOperation(EXIT_ON_CLOSE); this.core = core; core.addStateListener(new UISyncStateListener()); components = new ArrayList<JComponent>(); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenuItem openMenuItem = new JMenuItem("Open Mendeley database"); openMenuItem.addActionListener(new OpenMendeleyListener()); JMenuItem selectKindleMenuItem = new JMenuItem("Select Kindle device path"); selectKindleMenuItem.addActionListener(new SelectKindleListener()); JMenuItem exitMenuItem = new JMenuItem("Quit"); exitMenuItem.addActionListener(new QuitListener()); fileMenu.add(openMenuItem);//from w w w .j ava 2s . co m fileMenu.add(selectKindleMenuItem); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); JMenu helpMenu = new JMenu("Help"); JMenuItem aboutMenuItem = new JMenuItem("About"); aboutMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String text = "Mendeley2Kindle 0.3.2\n" + " (c) Copyright Yukinari Toyota, 2013. All rights reserved.\n" + " Contact: Yukinari Toyota <xxseyxx@gmail.com>\n" + " Site: http://sites.google.com/site/xxseyxx/\n" + "Some Icons by Yusuke Kamiyamane\n" + " Site: http://p.yusukekamiyamane.com/\n" + "sqlite-jdbc-3.7.2.jar is provided by xerial.org\n" + " under Apache License version 2.0 (http://www.apache.org/licenses/ )\n" + " Site: https://bitbucket.org/xerial/sqlite-jdbc\n"; JOptionPane.showMessageDialog(MainUIFrame.this, text); } }); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); setJMenuBar(menuBar); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); getContentPane().add(new JLabel("Select Mendeley collections")); collectionsJList = new JList(); DragSelectionListener mil = new DragSelectionListener(); collectionsJList.addMouseMotionListener(mil); collectionsJList.addMouseListener(mil); collectionsJList.setCellRenderer(new MyCellRenderer()); // collectionsJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); JScrollPane scroll = new JScrollPane(); scroll.setPreferredSize(new Dimension(200, 300)); scroll.getViewport().setView(collectionsJList); getContentPane().add(scroll); mainButton = new JButton("Open Mendeley database"); mainButton.addActionListener(new OpenMendeleyListener()); getContentPane().add(mainButton); components.add(collectionsJList); for (JComponent c : components) c.setEnabled(false); pack(); }
From source file:aplicarFiltros.PanelResultado.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Sebastian Colavita DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); panel2 = new JPanel(); panel1 = new JPanel(); scrollPaneRasgos2 = new JScrollPane(); tableRasgos2 = new JTable(); button1 = new JButton(); separator1 = compFactory.createSeparator("Clasificaci\u00f3n"); label1 = new JLabel(); resultado = new JLabel(); label2 = new JLabel(); Descuento = new JLabel(); panel3 = new JPanel(); panelGraficoPixel = new JPanel(); //======== this ======== // JFormDesigner evaluation mark setBorder(//w ww .j ava 2 s . co m new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), getBorder())); addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); setLayout(null); //======== panel2 ======== { panel2.setBackground(Color.blue); panel2.setLayout(null); //======== panel1 ======== { panel1.setBorder(new BevelBorder(BevelBorder.RAISED)); panel1.setLayout(null); //======== scrollPaneRasgos2 ======== { //---- tableRasgos2 ---- tableRasgos2.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Clasificaciones", "Cantidad", "Porcentaje Area" }) { Class<?>[] columnTypes = new Class<?>[] { String.class, String.class, Object.class }; @Override public Class<?> getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); tableRasgos2.setPreferredScrollableViewportSize(new Dimension(200, 100)); tableRasgos2.setBackground(UIManager.getColor("RadioButton.light")); tableRasgos2.setCellSelectionEnabled(true); scrollPaneRasgos2.setViewportView(tableRasgos2); } panel1.add(scrollPaneRasgos2); scrollPaneRasgos2.setBounds(10, 60, 605, 155); //---- button1 ---- button1.setIcon(new ImageIcon("\\\\img\\\\maiz_mon810_al.jpg")); panel1.add(button1); button1.setBounds(620, 60, 225, 155); panel1.add(separator1); separator1.setBounds(10, 5, 835, separator1.getPreferredSize().height); //---- label1 ---- label1.setText("Resultado:"); label1.setFont(new Font("Times New Roman", Font.BOLD, 13)); panel1.add(label1); label1.setBounds(10, 35, 67, label1.getPreferredSize().height); //---- resultado ---- resultado.setText("Grado A"); resultado.setFont(new Font("Times New Roman", Font.BOLD, 13)); resultado.setForeground(Color.blue); panel1.add(resultado); resultado.setBounds(79, 35, 171, 19); //---- label2 ---- label2.setText(" Descuento:"); label2.setFont(new Font("Times New Roman", Font.BOLD, 13)); panel1.add(label2); label2.setBounds(250, 35, 72, 19); //---- Descuento ---- Descuento.setText("10%"); Descuento.setFont(new Font("Times New Roman", Font.BOLD, 13)); Descuento.setForeground(Color.blue); panel1.add(Descuento); Descuento.setBounds(320, 35, 60, Descuento.getPreferredSize().height); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < panel1.getComponentCount(); i++) { Rectangle bounds = panel1.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = panel1.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panel1.setMinimumSize(preferredSize); panel1.setPreferredSize(preferredSize); } } panel2.add(panel1); panel1.setBounds(15, 10, 856, 225); //======== panel3 ======== { panel3.setBorder(new TitledBorder("Gr\u00e1ficos")); panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS)); //======== panelGraficoPixel ======== { panelGraficoPixel.setLayout(null); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < panelGraficoPixel.getComponentCount(); i++) { Rectangle bounds = panelGraficoPixel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = panelGraficoPixel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panelGraficoPixel.setMinimumSize(preferredSize); panelGraficoPixel.setPreferredSize(preferredSize); } } panel3.add(panelGraficoPixel); } panel2.add(panel3); panel3.setBounds(13, 245, 857, 355); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < panel2.getComponentCount(); i++) { Rectangle bounds = panel2.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = panel2.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panel2.setMinimumSize(preferredSize); panel2.setPreferredSize(preferredSize); } } add(panel2); panel2.setBounds(10, 5, 883, 610); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < getComponentCount(); i++) { Rectangle bounds = getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; setMinimumSize(preferredSize); setPreferredSize(preferredSize); } // JFormDesigner - End of component initialization //GEN-END:initComponents button1.setIcon(new ImageIcon("img\\maiz_mon810_al.jpg")); }
From source file:misc.TextBatchPrintingDemo.java
/** * Create and display the main application frame. *///from ww w. j a v a 2s. c o m void createAndShowGUI() { messageArea = new JLabel(defaultMessage); selectedPages = new JList(new DefaultListModel()); selectedPages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); selectedPages.addListSelectionListener(this); setPage(homePage); JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(pageItem), new JScrollPane(selectedPages)); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); /** Menu item and keyboard shortcuts for the "add page" command. */ fileMenu.add(createMenuItem(new AbstractAction("Add Page") { public void actionPerformed(ActionEvent e) { DefaultListModel pages = (DefaultListModel) selectedPages.getModel(); pages.addElement(pageItem); selectedPages.setSelectedIndex(pages.getSize() - 1); } }, KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK))); /** Menu item and keyboard shortcuts for the "print selected" command.*/ fileMenu.add(createMenuItem(new AbstractAction("Print Selected") { public void actionPerformed(ActionEvent e) { printSelectedPages(); } }, KeyEvent.VK_P, KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.ALT_MASK))); /** Menu item and keyboard shortcuts for the "clear selected" command.*/ fileMenu.add(createMenuItem(new AbstractAction("Clear Selected") { public void actionPerformed(ActionEvent e) { DefaultListModel pages = (DefaultListModel) selectedPages.getModel(); pages.removeAllElements(); } }, KeyEvent.VK_C, KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK))); fileMenu.addSeparator(); /** Menu item and keyboard shortcuts for the "home page" command. */ fileMenu.add(createMenuItem(new AbstractAction("Home Page") { public void actionPerformed(ActionEvent e) { setPage(homePage); } }, KeyEvent.VK_H, KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK))); /** Menu item and keyboard shortcuts for the "quit" command. */ fileMenu.add(createMenuItem(new AbstractAction("Quit") { public void actionPerformed(ActionEvent e) { for (Window w : Window.getWindows()) { w.dispose(); } } }, KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK))); JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); JPanel contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.add(pane); contentPane.add(messageArea); JFrame frame = new JFrame("Text Batch Printing Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setJMenuBar(menuBar); frame.setContentPane(contentPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); if (printService == null) { // Actual printing is not possible, issue a warning message. JOptionPane.showMessageDialog(frame, "No default print service", "Print Service Alert", JOptionPane.WARNING_MESSAGE); } }
From source file:edu.ucla.stat.SOCR.chart.SuperAreaChart_XY.java
protected void setChart() { // update graph // System.out.println("setChart called"); graphPanel.removeAll();// w ww. j ava2 s . com graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y)); if (legendPanelOn) { JFreeChart chart2 = createLegendChart(createLegend(dataset)); legendPanel = new ChartPanel(chart2, false); //legendPanel.setPreferredSize(new Dimension(CHART_SIZE_X,CHART_SIZE_Y*2/3)); } graphPanel.add(chartPanel); JScrollPane legendPane = new JScrollPane(legendPanel); if (legendPanelOn) { legendPane.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 5)); graphPanel.add(legendPane); } graphPanel.validate(); // get the GRAPH panel to the front if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) { tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel)); graphPanel.removeAll(); graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); graphPanel.add(chartPanel); if (legendPanelOn) { legendPane = new JScrollPane(legendPanel); legendPane.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 5)); graphPanel.add(legendPane); } graphPanel.validate(); } else { graphPanel2.removeAll(); chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3)); // legendPanel.setPreferredSize(new Dimension(CHART_SIZE_X*2/3,CHART_SIZE_Y*2/5)); graphPanel2.add(chartPanel); if (legendPanelOn) { legendPane = new JScrollPane(legendPanel); legendPane.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 5)); graphPanel2.add(legendPane); } graphPanel2.validate(); summaryPanel.validate(); } }
From source file:InterleavedNIOBuffer.java
public void init() { // create textures if (texImage1 == null) { // the path to the image for an applet try {/*from w w w . ja v a 2s . c o m*/ texImage1 = new java.net.URL(getCodeBase().toString() + "/bg.jpg"); } catch (java.net.MalformedURLException ex) { System.out.println(ex.getMessage()); System.exit(1); } } if (texImage2 == null) { // the path to the image for an applet try { texImage2 = new java.net.URL(getCodeBase().toString() + "/one.jpg"); } catch (java.net.MalformedURLException ex) { System.out.println(ex.getMessage()); System.exit(1); } } Container contentPane = getContentPane(); Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); contentPane.add("Center", c); BranchGroup scene = createSceneGraph(); // SimpleUniverse is a Convenience Utility class u = new SimpleUniverse(c); // add mouse behaviors to the viewingPlatform ViewingPlatform viewingPlatform = u.getViewingPlatform(); // This will move the ViewPlatform back a bit so the // objects in the scene can be viewed. viewingPlatform.setNominalViewingTransform(); // add Orbit behavior to the viewing platform OrbitBehavior orbit = new OrbitBehavior(c, OrbitBehavior.REVERSE_ALL); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); orbit.setSchedulingBounds(bounds); viewingPlatform.setViewPlatformBehavior(orbit); u.addBranchGraph(scene); // Create GUI JPanel p = new JPanel(); BoxLayout boxlayout = new BoxLayout(p, BoxLayout.Y_AXIS); p.add(createGeometryByReferencePanel()); p.setLayout(boxlayout); contentPane.add("South", p); }