List of usage examples for java.awt Color LIGHT_GRAY
Color LIGHT_GRAY
To view the source code for java.awt Color LIGHT_GRAY.
Click Source Link
From source file:techtonic.Onview.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 ww . j a v a2 s . c o m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { titleBarPanel = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); toolBarPanel = new javax.swing.JPanel(); axisPanel = new javax.swing.JPanel(); jcbX_Axis = new javax.swing.JComboBox<>(); jcbY_Axis = new javax.swing.JComboBox<>(); lblXAxis = new javax.swing.JLabel(); lblYAxis = new javax.swing.JLabel(); btnRender = new javax.swing.JButton(); utilityPanel = new javax.swing.JPanel(); maxBtn = new javax.swing.JButton(); saveBtn = new javax.swing.JButton(); exportBtn = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); wellCombo = new javax.swing.JComboBox<>(); jspWell = new javax.swing.JScrollPane(); btnWellPanel = new javax.swing.JPanel(); jspProperty = new javax.swing.JScrollPane(); tblProperty = new javax.swing.JTable(); statusBar = new javax.swing.JLabel(); btnSetProperties = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); trajectoryPanel = new javax.swing.JPanel(); logsPanel = new javax.swing.JPanel(); displayArea1 = new javax.swing.JPanel(); menBarTectTonic = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jmiNew = new javax.swing.JMenuItem(); jmiLoad = new javax.swing.JMenuItem(); jmiSave = new javax.swing.JMenuItem(); jmiExit = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenu3 = new javax.swing.JMenu(); jMenuItem5 = new javax.swing.JMenuItem(); jMenuItem6 = new javax.swing.JMenuItem(); jMenuItem7 = new javax.swing.JMenuItem(); jMenu4 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Well Data Processor -TechTonic"); setName("TechTonic"); // NOI18N setPreferredSize(new java.awt.Dimension(100, 200)); setSize(new java.awt.Dimension(1000, 1500)); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); titleBarPanel.setBackground(new java.awt.Color(0, 0, 0)); jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/techtonic/images/rlogo1.png"))); // NOI18N jLabel2.setText("jLabel2"); javax.swing.GroupLayout titleBarPanelLayout = new javax.swing.GroupLayout(titleBarPanel); titleBarPanel.setLayout(titleBarPanelLayout); titleBarPanelLayout.setHorizontalGroup( titleBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(titleBarPanelLayout.createSequentialGroup().addContainerGap() .addComponent(jLabel2).addContainerGap(1321, Short.MAX_VALUE))); titleBarPanelLayout.setVerticalGroup( titleBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, titleBarPanelLayout.createSequentialGroup() .addContainerGap(23, Short.MAX_VALUE).addComponent(jLabel2).addGap(20, 20, 20))); getContentPane().add(titleBarPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, 1620, 80)); toolBarPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2)); toolBarPanel.setPreferredSize(new java.awt.Dimension(100, 65)); axisPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2), "Plot", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N axisPanel.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N axisPanel.setMinimumSize(new java.awt.Dimension(100, 100)); axisPanel.setPreferredSize(new java.awt.Dimension(699, 99)); jcbX_Axis.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jcbX_Axis.setModel( new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jcbX_Axis.setBorder(null); jcbX_Axis.setMinimumSize(new java.awt.Dimension(69, 20)); jcbX_Axis.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jcbX_AxisItemStateChanged(evt); } }); jcbX_Axis.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jcbX_AxisActionPerformed(evt); } }); jcbY_Axis.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jcbY_Axis.setModel( new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jcbY_Axis.setBorder(null); jcbY_Axis.setMinimumSize(new java.awt.Dimension(69, 20)); jcbY_Axis.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jcbY_AxisActionPerformed(evt); } }); lblXAxis.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N lblXAxis.setText("X-Axis"); lblYAxis.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N lblYAxis.setText("Y-Axis"); btnRender.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N btnRender.setText("Render"); btnRender.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); btnRender.setEnabled(false); btnRender.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnRenderActionPerformed(evt); } }); javax.swing.GroupLayout axisPanelLayout = new javax.swing.GroupLayout(axisPanel); axisPanel.setLayout(axisPanelLayout); axisPanelLayout .setHorizontalGroup(axisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(axisPanelLayout.createSequentialGroup().addContainerGap().addComponent(lblXAxis) .addGap(18, 18, 18) .addComponent(jcbX_Axis, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblYAxis, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jcbY_Axis, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnRender, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE) .addGap(12, 12, 12))); axisPanelLayout .setVerticalGroup( axisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(axisPanelLayout.createSequentialGroup().addGap(9, 9, 9) .addGroup(axisPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblXAxis, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jcbX_Axis, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblYAxis) .addComponent(jcbY_Axis, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnRender, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))); utilityPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2), "Uitility", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N maxBtn.setIcon(new javax.swing.ImageIcon( "H:\\NetBeansProjects\\CMM021-Project-Team\\src\\techtonic\\images\\max.png")); // NOI18N maxBtn.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); maxBtn.setEnabled(false); maxBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { maxBtnActionPerformed(evt); } }); saveBtn.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N saveBtn.setText("Save"); saveBtn.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); saveBtn.setEnabled(false); saveBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveBtnActionPerformed(evt); } }); exportBtn.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N exportBtn.setText("Export"); exportBtn.setEnabled(false); exportBtn.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); exportBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exportBtnActionPerformed(evt); } }); javax.swing.GroupLayout utilityPanelLayout = new javax.swing.GroupLayout(utilityPanel); utilityPanel.setLayout(utilityPanelLayout); utilityPanelLayout.setHorizontalGroup( utilityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, utilityPanelLayout.createSequentialGroup().addContainerGap() .addComponent(maxBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(saveBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(exportBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE) .addContainerGap())); utilityPanelLayout.setVerticalGroup(utilityPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(utilityPanelLayout.createSequentialGroup() .addGroup(utilityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(maxBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(saveBtn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(exportBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(0, 0, 0))); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2), "Wells", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N wellCombo.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N wellCombo.setModel( new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); wellCombo.setBorder(null); wellCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { wellComboActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(13, 13, 13) .addComponent(wellCombo, 0, 404, Short.MAX_VALUE).addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(10, 10, 10) .addComponent(wellCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout toolBarPanelLayout = new javax.swing.GroupLayout(toolBarPanel); toolBarPanel.setLayout(toolBarPanelLayout); toolBarPanelLayout.setHorizontalGroup(toolBarPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(toolBarPanelLayout.createSequentialGroup().addGap(9, 9, 9) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(axisPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 887, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(utilityPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(6, 6, 6))); toolBarPanelLayout.setVerticalGroup(toolBarPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(toolBarPanelLayout.createSequentialGroup().addContainerGap().addGroup(toolBarPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(utilityPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(toolBarPanelLayout.createSequentialGroup() .addGroup(toolBarPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(axisPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); getContentPane().add(toolBarPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 101, 1620, 120)); jspWell.setPreferredSize(new java.awt.Dimension(1173, 2263)); btnWellPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2)); btnWellPanel.setPreferredSize(new java.awt.Dimension(100, 100)); javax.swing.GroupLayout btnWellPanelLayout = new javax.swing.GroupLayout(btnWellPanel); btnWellPanel.setLayout(btnWellPanelLayout); btnWellPanelLayout.setHorizontalGroup(btnWellPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 214, Short.MAX_VALUE)); btnWellPanelLayout.setVerticalGroup(btnWellPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 564, Short.MAX_VALUE)); jspWell.setViewportView(btnWellPanel); getContentPane().add(jspWell, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 240, 220, 570)); jspProperty.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)))); jspProperty.setPreferredSize(new java.awt.Dimension(1173, 2263)); ColorSelectionModel bgColorModel = new DefaultColorSelectionModel(Color.LIGHT_GRAY); ColorSelectionModel fgColorModel = new DefaultColorSelectionModel(Color.WHITE); TableButton t = new TableButton("hello"); tblProperty.setFont(new java.awt.Font("Verdana", 0, 12)); // NOI18N tblProperty.setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { "Background Colour", "color 1" }, { "Fore ground Colour", "color 2" }, { "Shape", t }, { "Shape Size" }, { "Label Colour" }, { null, null }, }, new String[] { "Properties", "Values" })); ///// table.getModel().getValueAt(row_index, col_index) TableModel tm = tblProperty.getModel(); TableColumn ce = tblProperty.getColumnModel().getColumn(1); // System.out.println(tm.getValueAt(1, 1)); // ce. jspProperty.setViewportView(tblProperty); if (tblProperty.getColumnModel().getColumnCount() > 0) { tblProperty.getColumnModel().getColumn(0).setResizable(false); tblProperty.getColumnModel().getColumn(1).setResizable(false); } getContentPane().add(jspProperty, new org.netbeans.lib.awtextra.AbsoluteConstraints(1340, 240, 290, 250)); statusBar.setForeground(new java.awt.Color(0, 51, 204)); statusBar.setText(" "); statusBar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2)); getContentPane().add(statusBar, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 830, 1620, -1)); btnSetProperties.setText("Set Properties"); getContentPane().add(btnSetProperties, new org.netbeans.lib.awtextra.AbsoluteConstraints(1340, 510, 290, 60)); btnSetProperties.setEnabled(false); btnSetProperties.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSetPropery(); } }); jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2)); trajectoryPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Trajectory")); javax.swing.GroupLayout trajectoryPanelLayout = new javax.swing.GroupLayout(trajectoryPanel); trajectoryPanel.setLayout(trajectoryPanelLayout); trajectoryPanelLayout.setHorizontalGroup(trajectoryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); trajectoryPanelLayout.setVerticalGroup(trajectoryPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 220, Short.MAX_VALUE)); logsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Logs")); javax.swing.GroupLayout logsPanelLayout = new javax.swing.GroupLayout(logsPanel); logsPanel.setLayout(logsPanelLayout); logsPanelLayout.setHorizontalGroup(logsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 172, Short.MAX_VALUE)); logsPanelLayout.setVerticalGroup(logsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 216, Short.MAX_VALUE)); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(logsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(trajectoryPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(trajectoryPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(logsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(241, 240, 230, 570)); javax.swing.GroupLayout displayArea1Layout = new javax.swing.GroupLayout(displayArea1); displayArea1.setLayout(displayArea1Layout); displayArea1Layout.setHorizontalGroup(displayArea1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 850, Short.MAX_VALUE)); displayArea1Layout.setVerticalGroup(displayArea1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 570, Short.MAX_VALUE)); displayArea1.setBorder(javax.swing.BorderFactory.createTitledBorder("Display Area")); getContentPane().add(displayArea1, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 240, 850, 570)); jMenu1.setText("File"); jmiNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); jmiNew.setText("New"); jMenu1.add(jmiNew); jmiLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK)); jmiLoad.setText("Load"); jmiLoad.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jmiLoadActionPerformed(evt); } }); jMenu1.add(jmiLoad); jmiSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); jmiSave.setText("Save"); jMenu1.add(jmiSave); jmiExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK)); jmiExit.setText("Exit"); jmiExit.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jmiExitMouseClicked(evt); } }); jmiExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jmiExitActionPerformed(evt); } }); jMenu1.add(jmiExit); menBarTectTonic.add(jMenu1); jMenu2.setText("Edit"); menBarTectTonic.add(jMenu2); jMenu3.setText("Visualize"); jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK)); jMenuItem5.setText("Scatter Plot"); jMenuItem5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem5ActionPerformed(evt); } }); jMenu3.add(jMenuItem5); jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.ALT_MASK)); jMenuItem6.setText("Bar Chat"); jMenu3.add(jMenuItem6); jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK)); jMenuItem7.setText("Line Graph"); jMenu3.add(jMenuItem7); menBarTectTonic.add(jMenu3); jMenu4.setText("About"); menBarTectTonic.add(jMenu4); setJMenuBar(menBarTectTonic); setSize(new java.awt.Dimension(1670, 982)); setLocationRelativeTo(null); }
From source file:edu.ucla.stat.SOCR.analyses.gui.Survival.java
protected void doGraph() { graphPanel.removeAll();/*from w w w . j ava 2s .c om*/ ////////System.out.println("in doGraph"); //graphPanel.add(description, BorderLayout.SOUTH); JFreeChart scatterChart = null; ChartPanel chartPanel1 = null; ChartPanel chartPanel2 = null; Chart chartFactory = new Chart(); String lineType = "excludesZeroNoShape"; /* double[] survivalTimePlot = new double[plotSize]; double[] survivalRatePlot = new double[plotSize]; //////////System.out.println("doGraph survivalTimePlot.length = " + survivalTimePlot.length); //////////System.out.println("doGraph survivalRatePlot.length = " + survivalRatePlot.length); int newIndex = 0; for (int i = 0; i < survivalRate.length; i++) { for (int j = 0; j < survivalRate[i].length; j++) { survivalTimePlot[newIndex] = survivalTime[i][j]; survivalRatePlot[newIndex] = survivalRate[i][j]; newIndex++; } } */ /* double[][] survivalTimePlot = new double[survivalTime.length][]; double[][] survivalRatePlot = new double[survivalRate.length][]; // create the first point (time = 0, rate = 1) for (int i = 0; i < survivalTime.length; i++) { survivalTimePlot[i] = new double[survivalTime[i].length + 1]; survivalRatePlot[i] = new double[survivalRate[i].length + 1]; survivalTimePlot[i][0] = 0; survivalRatePlot[i][0] = 1; for (int j = 1; j < survivalTimePlot[i].length; j++) { survivalTimePlot[i][j] = survivalTime[i][j - 1]; survivalRatePlot[i][j] = survivalRate[i][j - 1]; } } */ boolean useCI = true; // whether to plot the confidence interval. ////////System.out.println("useCI = " + useCI); double[][] survivalTimePlot = new double[survivalTime.length][]; double[][] survivalRatePlot = new double[survivalRate.length][]; double[][] survivalRateUpperCIPlot = new double[survivalRate.length][]; double[][] survivalRateLowerCIPlot = new double[survivalRate.length][]; // create the first point (time = 0, rate = 1) double tempTime = 0, tempRate = 0, tempRateUpperCI = 0, tempRateLowerCI = 0; int increment = 2; int arrayLength = 0; int k = 0; // index for survivalTime array, not for survivalTimePlot. for (int i = 0; i < survivalTime.length; i++) { arrayLength = 2 * survivalRate[i].length + increment; k = 0; // why add 2? one for the initial point, one for the last point. survivalTimePlot[i] = new double[arrayLength]; survivalRatePlot[i] = new double[arrayLength]; survivalRateUpperCIPlot[i] = new double[arrayLength]; survivalRateLowerCIPlot[i] = new double[arrayLength]; survivalTimePlot[i][0] = 0; survivalRatePlot[i][0] = 1; survivalRateUpperCIPlot[i][0] = 1; survivalRateLowerCIPlot[i][0] = 1; int j = 1; ////////System.out.println(" before loop survivalTimePlot["+i+"].length= " +survivalTimePlot[i].length); for (j = 1; j < survivalTimePlot[i].length - 1; j++) { //////////System.out.println("j = " + j + " survivalTimePlot["+i+"].length = " + survivalTimePlot[i].length + ", k = " + k); ////////System.out.println("in loop j = " + j); if (j % 2 == 1) { ////////System.out.println("in if j = " + j + ", k = " + k); survivalTimePlot[i][j] = survivalTime[i][k]; survivalRatePlot[i][j] = survivalRatePlot[i][j - 1]; survivalRateUpperCIPlot[i][j] = survivalRateUpperCIPlot[i][j - 1]; survivalRateLowerCIPlot[i][j] = survivalRateLowerCIPlot[i][j - 1]; tempTime = survivalTimePlot[i][j]; tempRate = survivalRatePlot[i][j]; tempRateUpperCI = survivalRateUpperCIPlot[i][j]; tempRateLowerCI = survivalRateLowerCIPlot[i][j]; } else { //////////System.out.println("in elsej = " + j); survivalTimePlot[i][j] = tempTime; survivalRatePlot[i][j] = survivalRate[i][k]; survivalRateUpperCIPlot[i][j] = upperCI[i][k]; survivalRateLowerCIPlot[i][j] = lowerCI[i][k]; k++; } ////////System.out.println("i = " + i + ", j = " + j + ", k = " + k + ", time["+i+"]["+j+"] = " + survivalTimePlot[i][j] + ". rate["+i+"]["+j+"] = " + survivalRatePlot[i][j]); } int index = j;//survivalTimePlot[i].length-1;//survivalTimePlot[i].length; ////////System.out.println("index = " + index); ////////System.out.println("maxTime["+i+"] = " + maxTime[i]); survivalTimePlot[i][index] = maxTime[i]; ////////System.out.println("survivalTimePlot["+i+"]["+index+"] = " + survivalTimePlot[i][index]); survivalRatePlot[i][index] = survivalRatePlot[i][index - 1]; survivalRateUpperCIPlot[i][index] = survivalRateUpperCIPlot[i][index - 1]; survivalRateLowerCIPlot[i][index] = survivalRateLowerCIPlot[i][index - 1]; } int numberGroups = 0, lineSetCount = 0, tempIndex = 0; double[][] finalTimeArray = null; double[][] finalRateArray = null; String[] finalGroupNames = null; int numberOfLines = 0; //lineSetCount * groupNames.length; Color[] colorArray = null;//new Color[numberOfLines]; ////////System.out.println("lineSetCount = " + lineSetCount); if (useCI) { numberGroups = groupNames.length; lineSetCount = 3; // use 4 if using censor points. tempIndex = 0; numberOfLines = lineSetCount * numberGroups; finalTimeArray = new double[numberOfLines][]; finalRateArray = new double[numberOfLines][]; finalGroupNames = new String[numberOfLines]; ////////System.out.println("numberOfLines = " + numberOfLines); colorArray = new Color[numberOfLines]; // why 3? one for rate, one for upper CI, one for lower CI. for (int i = 0; i < numberGroups; i++) { // repeat the same time. finalTimeArray[tempIndex] = survivalTimePlot[i]; finalTimeArray[tempIndex + 1] = survivalTimePlot[i]; finalTimeArray[tempIndex + 2] = survivalTimePlot[i]; //finalTimeArray[tempIndex+3] = censoredTime[i]; finalRateArray[tempIndex] = survivalRatePlot[i]; finalRateArray[tempIndex + 1] = survivalRateUpperCIPlot[i]; finalRateArray[tempIndex + 2] = survivalRateLowerCIPlot[i]; //finalRateArray[tempIndex+3] = censoredRate[i]; finalGroupNames[tempIndex] = groupNames[i]; finalGroupNames[tempIndex + 1] = groupNames[i] + " Upper CI"; finalGroupNames[tempIndex + 2] = groupNames[i] + " Lower CI"; //finalGroupNames[tempIndex+3] = groupNames[i] + " Censored"; if (i % 5 == 0) { colorArray[tempIndex] = Color.RED; colorArray[tempIndex + 1] = Color.PINK; colorArray[tempIndex + 2] = Color.PINK; } else if (i % 5 == 1) { colorArray[tempIndex] = Color.BLUE; colorArray[tempIndex + 1] = Color.CYAN; colorArray[tempIndex + 2] = Color.CYAN; } else if (i % 5 == 2) { colorArray[tempIndex] = Color.GRAY; colorArray[tempIndex + 1] = Color.LIGHT_GRAY; colorArray[tempIndex + 2] = Color.LIGHT_GRAY; } else if (i % 5 == 3) { colorArray[tempIndex] = Color.MAGENTA; colorArray[tempIndex + 1] = Color.PINK; colorArray[tempIndex + 2] = Color.PINK; } else { colorArray[tempIndex] = Color.GREEN; colorArray[tempIndex + 1] = Color.YELLOW; colorArray[tempIndex + 2] = Color.YELLOW; } tempIndex += lineSetCount; } } else { numberGroups = groupNames.length; lineSetCount = 2; tempIndex = 0; finalTimeArray = new double[lineSetCount * numberGroups][]; finalRateArray = new double[lineSetCount * numberGroups][]; finalGroupNames = new String[lineSetCount * numberGroups]; // why 3? one for rate, one for upper CI, one for lower CI. for (int i = 0; i < numberGroups; i++) { // repeat the same time. finalTimeArray[tempIndex] = survivalTimePlot[i]; finalTimeArray[tempIndex + 1] = censoredTime[i]; finalRateArray[tempIndex] = survivalRatePlot[i]; finalRateArray[tempIndex + 1] = censoredRate[i]; finalGroupNames[tempIndex] = groupNames[i]; //finalGroupNames[tempIndex+1] = groupNames[i] + " Censored"; tempIndex += lineSetCount; } } //scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", groupNames.length, groupNames, survivalTimePlot, survivalRatePlot, lineType); //scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", lineSetCount * groupNames.length, finalGroupNames, finalTimeArray, finalRateArray, lineType); // this one has color. //public JFreeChart getLineChart(String title, String xLabel, String yLabel, double[] x, double[] y, Color[] colors, String other) //public JFreeChart getLineChart(String title, String xLabel, String yLabel, int numberOfLines, String[] lineNames, double[][] x, double[][] y, Color[] colors, String other) //int numberOfLines = lineSetCount * groupNames.length; //Color[] colors = new Color[numberOfLines]; //scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", numberOfLines, finalGroupNames, finalTimeArray, finalRateArray, colorArray, lineType); scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", lineSetCount * groupNames.length, finalGroupNames, finalTimeArray, finalRateArray, colorArray, lineType); // this one has color. //for (int i = 0; i < survivalTime.length; i++) { //scatterChart = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", survivalTimePlot, survivalRatePlot, lineType); //} scatterChart.setTitle("Expected Survival Times with 95% Confidence Limits"); chartPanel1 = new ChartPanel(scatterChart, false); chartPanel1.setPreferredSize(new Dimension(plotWidth, plotHeight)); JPanel innerPanel = new JPanel(); JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); graphPanel.add(graphPane); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS)); graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); innerPanel.add(chartPanel1); // Add a second plot without the confidence intervals (confidence limits) int lineSetCount1 = lineSetCount - 2; int tempIndex1 = 0; double[][] finalTimeArray1 = new double[lineSetCount1 * numberGroups][]; double[][] finalRateArray1 = new double[lineSetCount1 * numberGroups][]; String[] finalGroupNames1 = new String[lineSetCount1 * numberGroups]; for (int i = 0; i < numberGroups; i++) { // repeat the same time. finalTimeArray1[tempIndex1] = survivalTimePlot[i]; //finalTimeArray1[tempIndex1+1] = censoredTime[i]; finalRateArray1[tempIndex1] = survivalRatePlot[i]; //finalRateArray1[tempIndex1+1] = censoredRate[i]; finalGroupNames1[tempIndex1] = groupNames[i]; tempIndex1 += lineSetCount1; } JFreeChart scatterChart1 = chartFactory.getLineChart("Rate vs. Time", "Time", "Rate", (lineSetCount1) * groupNames.length, finalGroupNames1, finalTimeArray1, finalRateArray1, colorArray, lineType); // this one has color. scatterChart1.setTitle("Expected Survival Times (Only)"); chartPanel2 = new ChartPanel(scatterChart1, false); chartPanel2.setPreferredSize(new Dimension(plotWidth, plotHeight)); innerPanel.add(chartPanel2); graphPanel.validate(); }
From source file:es.emergya.ui.gis.CustomMapView.java
/** * Dibuja una brujula apuntando al norte * // w ww . j a v a 2 s. c o m * @param g */ @SuppressWarnings("unused") private void drawCompass(Graphics g) { int x = 50, y = getHeight() - 50; // ((Graphics2D)g).rotate(Math.PI + lastFollowAngle, x, y); ((Graphics2D) g).rotate(-PI_MEDIO - getAngle(), x, y); g.setColor(Color.LIGHT_GRAY); g.fillOval(0, getHeight() - 100, 100, 100); g.setColor(Color.BLACK); g.fillRect(x - 3, y - 3, 50, 6); g.setColor(Color.RED); g.fillRect(x + 42, y - 3, 6, 6); }
From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.panel.Chromatogram1DHeatmapViewerPanel.java
public void setPlot(final XYPlot plot) { removeAxisListener();/*from w ww .ja v a2s . c o m*/ ADataset1D<?, IScan> dataset = null; if (plot.getDataset() instanceof ADataset1D) { dataset = (ADataset1D<?, IScan>) plot.getDataset(); } else { throw new IllegalArgumentException("Requires a plot with ADataset1D!"); } this.plot = plot; if (this.selectionOverlay != null) { this.content.remove(selectionOverlay); this.selectionOverlay = null; } if (selectionOverlay == null) { selectionOverlay = new SelectionOverlay(Color.LIGHT_GRAY, Color.RED, 2.5f, 2.5f, 0.66f); chartPanel.addOverlay(selectionOverlay); selectionOverlay.addChangeListener(chartPanel); this.content.add(selectionOverlay); } else { for (ISelection selection : selectionOverlay.getMouseClickSelection()) { selection.setDataset(dataset); } ISelection selection = selectionOverlay.getMouseHoverSelection(); if (selection != null) { selection.setDataset(dataset); } } if (selectionHandler == null) { selectionHandler = new InstanceContentSelectionHandler(this.content, selectionOverlay, InstanceContentSelectionHandler.Mode.valueOf((String) modeSpinner.getValue()), dataset, 1); } else { selectionHandler.setDataset(dataset); } if (mouseSelectionHandler == null) { mouseSelectionHandler = new XYMouseSelectionHandler<>(dataset); mouseSelectionHandler.addSelectionChangeListener(selectionOverlay); mouseSelectionHandler.addSelectionChangeListener(selectionHandler); chartPanel.addChartMouseListener(mouseSelectionHandler); } else { mouseSelectionHandler.setDataset(dataset); } XYItemRenderer xyir = plot.getRenderer(); if (xyir instanceof XYBlockRenderer) { XYBlockRenderer xybr = (XYBlockRenderer) xyir; boxWidthSpinner.setValue(xybr.getBlockWidth()); boxHeightSpinner.setValue(xybr.getBlockHeight()); } AxisChangeListener listener = selectionOverlay; ValueAxis domain = this.plot.getDomainAxis(); ValueAxis range = this.plot.getRangeAxis(); if (domain != null) { domain.addChangeListener(listener); } if (range != null) { range.addChangeListener(listener); } this.plot.setNoDataMessage("Loading Data..."); chart = new JFreeChart(this.plot); chartPanel.setChart(chart); dmkl = new DomainMarkerKeyListener(this.plot); dmkl.setPlot(this.plot); chartPanel.addKeyListener(dmkl); addAxisListener(); //add available chart overlays ArrayList<? extends Overlay> overlays = new ArrayList<>(getLookup().lookupAll(Overlay.class)); Collections.sort(overlays, new Comparator<Overlay>() { @Override public int compare(Overlay o1, Overlay o2) { if (o1 instanceof ChartOverlay && o2 instanceof ChartOverlay) { ChartOverlay co1 = (ChartOverlay) o1; ChartOverlay co2 = (ChartOverlay) o2; return Integer.compare(co1.getLayerPosition(), co2.getLayerPosition()); } else { return 0; } } }); for (Overlay overlay : overlays) { if (!(overlay instanceof SelectionOverlay)) { chartPanel.removeOverlay(overlay); if (overlay instanceof AxisChangeListener) { AxisChangeListener axisChangeListener = (AxisChangeListener) overlay; if (domain != null) { domain.addChangeListener(axisChangeListener); } if (range != null) { range.addChangeListener(axisChangeListener); } } if (overlay instanceof ISelectionChangeListener) { ISelectionChangeListener isl = (ISelectionChangeListener) overlay; mouseSelectionHandler.addSelectionChangeListener(isl); mouseSelectionHandler.addSelectionChangeListener(selectionHandler); selectionOverlay.addChangeListener(chartPanel); } chartPanel.addOverlay(overlay); overlay.addChangeListener(chartPanel); } } //add selection overlay last chartPanel.removeOverlay(selectionOverlay); chartPanel.addOverlay(selectionOverlay); setViewPortAround((double) jSlider2.getValue()); double rangeValue = chartPanel.getChart().getXYPlot().getDomainAxis().getAutoRangeMinimumSize(); ((NumberAxis) chartPanel.getChart().getXYPlot().getDomainAxis()).setAutoRange(false); // chartPanel.getChart().getXYPlot().getDomainAxis().setFixedDimension(rangeValue / 10.0d); ((NumberAxis) chartPanel.getChart().getXYPlot().getDomainAxis()).setAutoRangeIncludesZero(false); ((NumberAxis) chartPanel.getChart().getXYPlot().getDomainAxis()).setRangeType(RangeType.POSITIVE); }
From source file:com.vgi.mafscaling.VECalc.java
protected boolean displayData() { try {// w w w . j a v a 2 s.c om int cnt; double x, y, val; boolean isMaf = (dataType.getSelectedIndex() == 0 ? true : false); ArrayList<LogData> data; HashMap<Double, ArrayList<LogData>> yData; Color[][] colorMatrix = new Color[corrTable.getRowCount()][corrTable.getColumnCount()]; for (int i = 1; i < xAxisArray.size() + 1; ++i) { newTable.setValueAt(origTable.getValueAt(0, i), 0, i); corrTable.setValueAt(origTable.getValueAt(0, i), 0, i); corrCountTable.setValueAt(origTable.getValueAt(0, i), 0, i); for (int j = 1; j < yAxisArray.size() + 1; ++j) { if (i == 1) { newTable.setValueAt(origTable.getValueAt(j, 0), j, 0); corrTable.setValueAt(origTable.getValueAt(j, 0), j, 0); corrCountTable.setValueAt(origTable.getValueAt(j, 0), j, 0); } x = xAxisArray.get(i - 1); y = yAxisArray.get(j - 1); yData = xData.get(x); if (yData == null) newTable.setValueAt(origTable.getValueAt(j, i), j, i); else { data = yData.get(y); if (data == null) newTable.setValueAt(origTable.getValueAt(j, i), j, i); else { cnt = data.size(); val = 0; for (LogData d : data) val += (isMaf ? d.sderr : d.afrerr); val /= cnt; corrTable.setValueAt(val, j, i); corrCountTable.setValueAt(cnt, j, i); if (cnt > minCellHitCount) { val = 1 + (val / 100.0 * corrApplied) / 100.0; if (isMaf) newTable.setValueAt(Double.valueOf(origTable.getValueAt(j, i).toString()) / val, j, i); else newTable.setValueAt(Double.valueOf(origTable.getValueAt(j, i).toString()) * val, j, i); colorMatrix[j][i] = Color.PINK; } else newTable.setValueAt(origTable.getValueAt(j, i), j, i); } } } } Utils.colorTable(newTable); for (int i = 0; i < colorMatrix.length; ++i) colorMatrix[i][0] = Color.LIGHT_GRAY; for (int i = 0; i < colorMatrix[0].length; ++i) colorMatrix[0][i] = Color.LIGHT_GRAY; ((BgColorFormatRenderer) corrTable.getDefaultRenderer(Object.class)).setColors(colorMatrix); ((BgColorFormatRenderer) corrCountTable.getDefaultRenderer(Object.class)).setColors(colorMatrix); plotCorrectionData(); return true; } catch (Exception e) { logger.error(e); JOptionPane.showMessageDialog(null, e, "Error processing data", JOptionPane.ERROR_MESSAGE); } return false; }
From source file:org.fhcrc.cpl.viewer.quant.gui.QuantitationReviewer.java
/** * Update lots of UI components after a change of quantitation event *///from www .j a v a 2s. co m protected void updateUIAfterChange(boolean shouldUpdateTable) { QuantEvent quantEvent = quantEvents.get(displayedEventIndex); if (displayedEventIndex > 0) backButton.setEnabled(true); else backButton.setEnabled(false); if (displayedEventIndex < quantEvents.size() - 1) forwardButton.setEnabled(true); else forwardButton.setEnabled(false); showEventSummaryButton.setEnabled(true); onePeakRatioRadioButton.setText("" + Rounder.round(quantEvent.getRatioOnePeak(), 2)); Enumeration<AbstractButton> quantButtons = quantCurationButtonGroup.getElements(); while (quantButtons.hasMoreElements()) quantButtons.nextElement().setEnabled(true); Enumeration<AbstractButton> idButtons = idCurationButtonGroup.getElements(); while (idButtons.hasMoreElements()) idButtons.nextElement().setEnabled(true); navigationPanel.setBorder(BorderFactory .createTitledBorder("Event " + (displayedEventIndex + 1) + " / " + quantEvents.size())); ButtonModel buttonModelToSelect = null; switch (quantEvent.getQuantCurationStatus()) { case QuantEvent.CURATION_STATUS_UNKNOWN: buttonModelToSelect = unknownRadioButtonModel; break; case QuantEvent.CURATION_STATUS_GOOD: buttonModelToSelect = goodRadioButtonModel; break; case QuantEvent.CURATION_STATUS_BAD: buttonModelToSelect = badRadioButtonModel; break; case QuantEvent.CURATION_STATUS_RATIO_ONEPEAK: buttonModelToSelect = onePeakRadioButtonModel; break; } quantCurationButtonGroup.setSelected(buttonModelToSelect, true); switch (quantEvent.getIdCurationStatus()) { case QuantEvent.CURATION_STATUS_UNKNOWN: buttonModelToSelect = idUnknownRadioButtonModel; break; case QuantEvent.CURATION_STATUS_GOOD: buttonModelToSelect = idGoodRadioButtonModel; break; case QuantEvent.CURATION_STATUS_BAD: buttonModelToSelect = idBadRadioButtonModel; break; } idCurationButtonGroup.setSelected(buttonModelToSelect, true); multiChartDisplay.setPreferredSize(new Dimension(rightPanel.getWidth(), rightPanel.getHeight())); multiChartDisplay.updateUI(); commentTextField.setText(quantEvent.getComment() != null ? quantEvent.getComment() : ""); commentTextField.setToolTipText( quantEvent.getComment() != null ? quantEvent.getComment() : "Comment on this event"); //dhmay danger of infinite loop here if (shouldUpdateTable) eventSummaryTable.getSelectionModel().setSelectionInterval(displayedEventIndex, displayedEventIndex); QuantEventAssessor.QuantEventAssessment assessment = quantEvent.getAlgorithmicAssessment(); if (assessment == null) { assessmentTypeTextField.setText(""); assessmentDescTextField.setText(""); assessmentTypeTextField.setBackground(Color.LIGHT_GRAY); } else { assessmentTypeTextField.setText(QuantEventAssessor.flagReasonDescriptions[assessment.getStatus()]); assessmentDescTextField.setText(assessment.getExplanation()); Color bgColor = assessmentPanel.getBackground(); switch (assessment.getStatus()) { case QuantEventAssessor.FLAG_REASON_UNEVALUATED: bgColor = Color.YELLOW; break; case QuantEventAssessor.FLAG_REASON_OK: bgColor = Color.GREEN; break; default: bgColor = Color.RED; break; } assessmentTypeTextField.setBackground(bgColor); } assessmentDescTextField.setToolTipText(assessmentDescTextField.getText()); showTheoreticalPeaks(); }
From source file:org.kuali.kfs.module.ar.batch.service.impl.LockboxServiceImpl.java
protected void writeBatchGroupSectionTitle(com.lowagie.text.Document pdfDoc, String batchSeqNbr, java.sql.Date procInvDt, String cashControlDocNumber) { Font font = FontFactory.getFont(FontFactory.COURIER, 10, Font.BOLD); String lineText = "CASHCTL " + rightPad(cashControlDocNumber, 12) + " " + "BATCH GROUP: " + rightPad(batchSeqNbr, 5) + " " + rightPad((procInvDt == null ? "NONE" : procInvDt.toString()), 35); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(com.lowagie.text.Element.ALIGN_LEFT); Chunk chunk = new Chunk(lineText, font); chunk.setBackground(Color.LIGHT_GRAY, 5, 5, 5, 5); paragraph.add(chunk);/* ww w. j a v a 2 s .c o m*/ // blank line paragraph.add(new Chunk("", font)); try { pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }
From source file:org.pentaho.ui.xul.swing.tags.SwingTree.java
private TableCellEditor getCellEditor(final SwingTreeCol col) { return new DefaultCellEditor(new JComboBox()) { JComponent control;/*from w w w . j a v a 2 s . c o m*/ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, final int row, final int column) { Component comp; ColumnType colType = col.getColumnType(); if (colType == ColumnType.DYNAMIC) { colType = ColumnType.valueOf(extractDynamicColType(elements.toArray()[row], column)); } final XulTreeCell cell = getRootChildren().getItem(row).getRow().getCell(column); switch (colType) { case CHECKBOX: final JCheckBox checkbox = new JCheckBox(); final JTable tbl = table; checkbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { SwingTree.this.table.setValueAt(checkbox.isSelected(), row, column); tbl.getCellEditor().stopCellEditing(); } }); control = checkbox; if (value instanceof String) { checkbox.setSelected(((String) value).equalsIgnoreCase("true")); //$NON-NLS-1$ } else if (value instanceof Boolean) { checkbox.setSelected((Boolean) value); } else if (value == null) { checkbox.setSelected(false); } if (isSelected) { checkbox.setBackground(Color.LIGHT_GRAY); } comp = checkbox; checkbox.setEnabled(!cell.isDisabled()); break; case EDITABLECOMBOBOX: case COMBOBOX: Vector val = (value != null && value instanceof Vector) ? (Vector) value : new Vector(); final JComboBox comboBox = new JComboBox(val); if (isSelected) { comboBox.setBackground(Color.LIGHT_GRAY); } if (colType == ColumnType.EDITABLECOMBOBOX) { comboBox.setEditable(true); final JTextComponent textComp = (JTextComponent) comboBox.getEditor().getEditorComponent(); textComp.addKeyListener(new KeyListener() { private String oldValue = ""; //$NON-NLS-1$ public void keyPressed(KeyEvent e) { oldValue = textComp.getText(); } public void keyReleased(KeyEvent e) { if (oldValue != null && !oldValue.equals(textComp.getText())) { SwingTree.this.table.setValueAt(textComp.getText(), row, column); oldValue = textComp.getText(); } else if (oldValue == null) { // AWT error where sometimes the keyReleased is fired before keyPressed. oldValue = textComp.getText(); } else { logger.debug("Special key pressed, ignoring"); //$NON-NLS-1$ } } public void keyTyped(KeyEvent e) { } }); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { // if(textComp.hasFocus() == false && comboBox.hasFocus()){ SwingTree.logger.debug("Setting ComboBox value from editor: " //$NON-NLS-1$ + comboBox.getSelectedItem() + ", " + row + ", " + column); //$NON-NLS-1$ //$NON-NLS-2$ SwingTree.this.table.setValueAt(comboBox.getSelectedIndex(), row, column); // } } }); } else { comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { SwingTree.logger.debug("Setting ComboBox value from editor: " //$NON-NLS-1$ + comboBox.getSelectedItem() + ", " + row + ", " + column); //$NON-NLS-1$ //$NON-NLS-2$ SwingTree.this.table.setValueAt(comboBox.getSelectedIndex(), row, column); } }); } control = comboBox; comboBox.setEnabled(!cell.isDisabled()); comp = comboBox; break; case LABEL: JLabel lbl = new JLabel(cell.getLabel()); comp = lbl; control = lbl; break; case CUSTOM: return new CustomCellEditorWrapper(cell, customEditors.get(col.getType())); default: final JTextField label = new JTextField((String) value); label.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent arg0) { SwingTree.this.table.setValueAt(label.getText(), row, column); } public void insertUpdate(DocumentEvent arg0) { SwingTree.this.table.setValueAt(label.getText(), row, column); } public void removeUpdate(DocumentEvent arg0) { SwingTree.this.table.setValueAt(label.getText(), row, column); } }); if (isSelected) { label.setOpaque(true); // label.setBackground(Color.LIGHT_GRAY); } control = label; comp = label; label.setEnabled(!cell.isDisabled()); label.setDisabledTextColor(Color.DARK_GRAY); break; } return comp; } @Override public Object getCellEditorValue() { if (control instanceof JCheckBox) { return ((JCheckBox) control).isSelected(); } else if (control instanceof JComboBox) { JComboBox box = (JComboBox) control; if (box.isEditable()) { return ((JTextComponent) box.getEditor().getEditorComponent()).getText(); } else { return box.getSelectedIndex(); } } else if (control instanceof JTextField) { return ((JTextField) control).getText(); } else { return ((JLabel) control).getText(); } } }; }
From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java
private JFreeChart updateBubbleChartChart(Set<QuantDiseaseGroupsComparison> selectedComparisonList) { if (userCustomizedComparison != null) { return updateBubbleChartChartWithCustUserData(selectedComparisonList); }//from w ww . j av a 2 s . co m tooltipsProtNumberMap.clear(); DefaultXYZDataset defaultxyzdataset = new DefaultXYZDataset(); int counter = 0; int upper = -1; boolean significantOnly = this.Quant_Central_Manager.isSignificantOnly(); for (QuantDiseaseGroupsComparison qc : selectedComparisonList) { if (significantOnly) { int upperCounter = 0; for (DiseaseGroupsComparisonsProteinLayout qp : qc.getComparProtsMap().values()) { if (qp == null) { continue; } if (qp.getSignificantTrindCategory() == 2 || qp.getSignificantTrindCategory() == 5) { continue; } upperCounter++; } if (upperCounter > upper) { upper = upperCounter; } } else { if (qc.getComparProtsMap() == null) { System.out.println("null qc " + qc.getComparisonHeader()); } if (qc.getComparProtsMap().size() > upper) { upper = qc.getComparProtsMap().size(); } } } final Map<Integer, Color[]> seriousColorMap = new HashMap<Integer, Color[]>(); Color[] dataColor = new Color[] { Color.WHITE, new Color(0, 153, 0), new Color(0, 229, 132), stableColor, new Color(247, 119, 119), new Color(204, 0, 0), Color.WHITE }; double[] yAxisValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 }; double[] xAxisValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 }; double[] widthValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 }; double[][] seriesValuesI = { yAxisValueI, xAxisValueI, widthValueI }; seriousColorMap.put(0, new Color[] { Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE }); defaultxyzdataset.addSeries(" ", seriesValuesI); for (QuantDiseaseGroupsComparison qc : selectedComparisonList) { double[] tempWidthValue = new double[8]; if (qc.getComparProtsMap() == null) { continue; } for (String key : qc.getComparProtsMap().keySet()) { qc.getComparProtsMap().get(key).updateLabelLayout(); if (significantOnly && (qc.getComparProtsMap().get(key).getSignificantTrindCategory() == 2 || qc.getComparProtsMap().get(key).getSignificantTrindCategory() == 5)) { tempWidthValue[3] = 0; tempWidthValue[6] = 0; } else { tempWidthValue[qc.getComparProtsMap().get(key).getSignificantTrindCategory() + 1] = tempWidthValue[qc.getComparProtsMap().get(key).getSignificantTrindCategory() + 1] + 1; } } if (tempWidthValue[3] > 0 && tempWidthValue[3] >= 0) { stableColor = new Color(1, 141, 244); } else { stableColor = Color.decode("#b5babb"); } tempWidthValue[3] = tempWidthValue[3] + tempWidthValue[6]; tempWidthValue[6] = 0; dataColor[3] = stableColor; int length = 0; if (upper < 10) { upper = 10; } double[] tooltipNumbess = new double[tempWidthValue.length]; System.arraycopy(tempWidthValue, 0, tooltipNumbess, 0, tempWidthValue.length); this.tooltipsProtNumberMap.put(qc.getComparisonHeader(), tooltipNumbess); for (int x = 0; x < tempWidthValue.length; x++) { if (tempWidthValue[x] > 0) { tempWidthValue[x] = scaleValues(tempWidthValue[x], upper, 2.5, 0.05);//Math.max(tempWidthValue[x] * 1.5 / upper, 0.05); length++; } } double[] yAxisValue = new double[length]; double[] xAxisValue = new double[length]; double[] widthValue = new double[length]; Color[] serColorArr = new Color[length]; length = 0; for (int x = 0; x < tempWidthValue.length; x++) { if (tempWidthValue[x] > 0) { xAxisValue[length] = x; yAxisValue[length] = counter + 1; widthValue[length] = tempWidthValue[x]; serColorArr[length] = dataColor[x]; length++; } } if (length == 1 && selectedComparisonList.size() == 1) { widthValue[0] = 1; } seriousColorMap.put(counter + 1, serColorArr); double[][] seriesValues = { yAxisValue, xAxisValue, widthValue }; defaultxyzdataset.addSeries(qc.getComparisonHeader(), seriesValues); counter++; } double[] yAxisValueII = new double[0]; double[] xAxisValueII = new double[0]; double[] widthValueII = new double[0]; seriousColorMap.put(counter + 1, new Color[] {}); double[][] seriesValuesII = { yAxisValueII, xAxisValueII, widthValueII }; defaultxyzdataset.addSeries(" ", seriesValuesII); final Color[] labelsColor = new Color[] { Color.LIGHT_GRAY, new Color(80, 183, 71), Color.LIGHT_GRAY, new Color(1, 141, 244), Color.LIGHT_GRAY, new Color(204, 0, 0), Color.LIGHT_GRAY }; Font font = new Font("Verdana", Font.BOLD, 13); SymbolAxis yAxis = new SymbolAxis(null, new String[] { " ", "Decreased", " ", "Equal", " ", "Increased", " " }) { int i = 0; @Override public RectangleInsets getTickLabelInsets() { // System.out.println("at ---- super.getTickLabelInsets() " + super.getTickLabelInsets()); // if (i == 0) { // i++; // return new RectangleInsets(-5, -5, 0, 0); // }else // return super.getTickLabelInsets(); //To change body of generated methods, choose Tools | Templates. } int x = 0; @Override public Paint getTickLabelPaint() { if (x >= labelsColor.length) { x = 0; } return labelsColor[x++]; } }; yAxis.setAutoRangeStickyZero(true); yAxis.setFixedAutoRange(8); yAxis.setTickLabelFont(font); yAxis.setGridBandsVisible(false); yAxis.setAxisLinePaint(Color.LIGHT_GRAY); yAxis.setTickMarksVisible(false); yAxis.setUpperBound(6); String[] xAxisLabels = new String[selectedComparisonList.size() + 2]; int x = 0; xAxisLabels[x] = ""; int maxLength = -1; //init labels color final Color[] diseaseGroupslabelsColor = new Color[selectedComparisonList.size() + 2]; diseaseGroupslabelsColor[x] = Color.WHITE; x++; for (QuantDiseaseGroupsComparison comp : selectedComparisonList) { String header = comp.getComparisonHeader(); String updatedHeader = header.split(" / ")[0].split("\n")[0] + " / " + header.split(" / ")[1].split("\n")[0] + ""; xAxisLabels[x] = updatedHeader + " (" + comp.getDatasetIndexes().length + ") "; if (xAxisLabels[x].length() > maxLength) { maxLength = xAxisLabels[x].length(); } diseaseGroupslabelsColor[x] = diseaseColorMap.get(header.split(" / ")[0].split("\n")[1]); x++; } xAxisLabels[x] = ""; diseaseGroupslabelsColor[x] = Color.WHITE; SymbolAxis xAxis; final boolean finalNum; finalNum = maxLength > 30 && selectedComparisonList.size() > 4; xAxis = new SymbolAxis(null, xAxisLabels) { int x = 0; @Override public Paint getTickLabelPaint() { if (x >= diseaseGroupslabelsColor.length) { x = 0; } return diseaseGroupslabelsColor[x++]; } private final boolean localfinal = finalNum; @Override protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) { if (localfinal) { setVerticalTickLabels(localfinal); return super.refreshTicksHorizontal(g2, dataArea, edge); } List ticks = new java.util.ArrayList(); Font tickLabelFont = getTickLabelFont(); g2.setFont(tickLabelFont); double size = getTickUnit().getSize(); int count = calculateVisibleTickCount(); double lowestTickValue = calculateLowestVisibleTickValue(); double previousDrawnTickLabelPos = 0.0; double previousDrawnTickLabelLength = 0.0; if (count <= ValueAxis.MAXIMUM_TICK_COUNT) { for (int i = 0; i < count; i++) { double currentTickValue = lowestTickValue + (i * size); double xx = valueToJava2D(currentTickValue, dataArea, edge); String tickLabel; NumberFormat formatter = getNumberFormatOverride(); if (formatter != null) { tickLabel = formatter.format(currentTickValue) + " "; } else { tickLabel = valueToString(currentTickValue) + " "; } // avoid to draw overlapping tick labels Rectangle2D bounds = TextUtilities.getTextBounds(tickLabel, g2, g2.getFontMetrics()); double tickLabelLength = isVerticalTickLabels() ? bounds.getHeight() : bounds.getWidth(); boolean tickLabelsOverlapping = false; if (i > 0) { double avgTickLabelLength = (previousDrawnTickLabelLength + tickLabelLength) / 2.0; if (Math.abs(xx - previousDrawnTickLabelPos) < avgTickLabelLength) { tickLabelsOverlapping = true; } } if (tickLabelsOverlapping) { setVerticalTickLabels(true); } else { // remember these values for next comparison previousDrawnTickLabelPos = xx; previousDrawnTickLabelLength = tickLabelLength; } TextAnchor anchor; TextAnchor rotationAnchor; double angle = 0.0; if (isVerticalTickLabels()) { anchor = TextAnchor.CENTER_RIGHT; rotationAnchor = TextAnchor.CENTER_RIGHT; if (edge == RectangleEdge.TOP) { angle = 76.5; } else { angle = -76.5; } } else { if (edge == RectangleEdge.TOP) { anchor = TextAnchor.BOTTOM_CENTER; rotationAnchor = TextAnchor.BOTTOM_CENTER; } else { anchor = TextAnchor.TOP_CENTER; rotationAnchor = TextAnchor.TOP_CENTER; } } Tick tick = new NumberTick(new Double(currentTickValue), tickLabel, anchor, rotationAnchor, angle); ticks.add(tick); } } return ticks; } }; // } xAxis.setTickLabelFont(font); xAxis.setTickLabelInsets(new RectangleInsets(2, 20, 2, 20)); xAxis.setAutoRangeStickyZero(true); xAxis.setTickMarksVisible(false); xAxis.setUpperBound(diseaseGroupslabelsColor.length - 1); xAxis.setGridBandsVisible(false); xAxis.setAxisLinePaint(Color.LIGHT_GRAY); int scale = XYBubbleRenderer.SCALE_ON_RANGE_AXIS; XYItemRenderer xyitemrenderer = new XYBubbleRenderer(scale) { private int counter = 0; private int localSerious = -1; private final Map<Integer, Color[]> localSeriousColorMap = seriousColorMap; @Override public Paint getSeriesPaint(int series) { if (series != localSerious || isNewImge || localSeriousColorMap.get(series).length == counter) { counter = 0; isNewImge = false; } localSerious = series; Color c = localSeriousColorMap.get(series)[counter]; counter++; return c; } }; XYPlot xyplot = new XYPlot(defaultxyzdataset, xAxis, yAxis, xyitemrenderer) { @Override protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area, List ticks) { try { if (!ticks.isEmpty()) { ticks.remove(0); } if (!ticks.isEmpty()) { ticks.remove(ticks.size() - 1); } } catch (Exception e) { } super.drawRangeGridlines(g2, area, ticks); //To change body of generated methods, choose Tools | Templates. } // private final Color[] labelsColor = new Color[]{new Color(0, 153, 0), new Color(0, 229, 132), new Color(1, 141, 244), new Color(255, 51, 51), new Color(204, 0, 0), Color.decode("#b5babb")}; // // private final Font font = new Font("Verdana", Font.PLAIN, 12); // private final String[] labels = new String[]{"Decreased 100%", "Decreased <100% ", "Equal", " Increased <100%", "Increased 100%", "No Quant. Info."}; // // @Override // public LegendItemCollection getLegendItems() { // LegendItemCollection legendItemCollection = new LegendItemCollection(); // for (int i = 0; i < labelsColor.length; i++) { // LegendItem item = new LegendItem(labels[i], labelsColor[i]); // item.setLabelFont(font); // // legendItemCollection.add(item); // // } // // return legendItemCollection;//To change body of generated methods, choose Tools | Templates. // } }; JFreeChart generatedChart = new JFreeChart(xyplot) { }; xyplot.setOutlineVisible(false); LegendTitle legend = generatedChart.getLegend(); legend.setVisible(false); // legend.setMargin(20, 0, 0, 0); //// legend.setBorder(1, 1, 1, 1); // legend.setFrame(new BlockBorder(1, 0, 1, 0, Color.LIGHT_GRAY)); // generatedChart.removeLegend(); // xyplot.setForegroundAlpha(0.65F); xyplot.setBackgroundPaint(Color.WHITE); generatedChart.setBackgroundPaint(Color.WHITE); generatedChart.setPadding(new RectangleInsets(0, 0, 0, 0)); Quant_Central_Manager.setProteinsOverviewBubbleChart(generatedChart); // exporter.writeChartToPDFFile(generatedChart, 595, 842, "bublechart.pdf"); return generatedChart; }
From source file:charts.Chart.java
public static JFreeChart MultipleStepChartOverlayed(XYDataset[] datasets1, XYDataset[] datasets2, String title, String x_axis_label, String y_axis_label, boolean showlegend, float maxvalue, float minvalue, boolean showchart) { ValueAxis domainAxis = new NumberAxis(x_axis_label); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ValueAxis rangeAxis = new NumberAxis(y_axis_label); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); if (minvalue == 0 && maxvalue == 0) { rangeAxis.setAutoRange(true);//from w w w .ja v a 2 s . c o m } else { rangeAxis.setRange(minvalue, maxvalue); } //define o grafo combinado, determinando o label do eixo x. CombinedDomainXYPlot parent = new CombinedDomainXYPlot(domainAxis); for (int i = 0; i < datasets1.length; i++) { XYItemRenderer renderer1 = new XYStepRenderer(); renderer1.setBaseStroke(new BasicStroke(2.0f)); renderer1.setBaseSeriesVisibleInLegend(showlegend); XYPlot subplot = new XYPlot(datasets1[i], domainAxis, rangeAxis, renderer1); subplot.setBackgroundPaint(Color.white); subplot.setRangeGridlinePaint(Color.black); subplot.setDomainGridlinesVisible(true); XYSplineRenderer renderer2 = new XYSplineRenderer(); renderer2.setSeriesPaint(0, Color.LIGHT_GRAY); renderer2.setBaseStroke(new BasicStroke(2.0f)); renderer2.setShapesVisible(true); renderer2.setBaseSeriesVisibleInLegend(false); subplot.setDataset(1, datasets2[i]); subplot.setRenderer(1, renderer2); parent.add(subplot, 1); } JFreeChart jfreechart = new JFreeChart(title, parent); JPanel jpanel = new ChartPanel(jfreechart); jpanel.setPreferredSize(new Dimension(defaultwidth, defaultheight)); if (showchart) { JFrame chartwindow = new JFrame(title); chartwindow.setContentPane(jpanel); chartwindow.pack(); RefineryUtilities.centerFrameOnScreen(chartwindow); chartwindow.setVisible(true); } return jfreechart; }