List of usage examples for java.awt Component setForeground
public void setForeground(Color c)
From source file:au.com.jwatmuff.eventmanager.gui.scoreboard.ScoreboardDisplayPanel.java
void updateColors() { ScoringColors colors = model.getColors(); switch (model.getHolddownPlayer()) { case 0://from w w w . j a v a 2 s. c o m holddownTimer.setBackground(colors.getColor(Area.PLAYER1_BACKGROUND)); holddownTimer.setForeground(colors.getColor(Area.PLAYER1_FOREGROUND)); break; case 1: holddownTimer.setBackground(colors.getColor(Area.PLAYER2_BACKGROUND)); holddownTimer.setForeground(colors.getColor(Area.PLAYER2_FOREGROUND)); break; default: holddownTimer.setBackground(colors.getColor(Area.IDLE_BACKGROUND)); holddownTimer.setForeground(colors.getColor(Area.IDLE_FOREGROUND)); } for (ScalableLabel label : new ScalableLabel[] { timer, goldenScore, goldenScoreApprove, vs, division, vsDivision, pendingDivision }) { label.setForeground(Color.BLACK); label.setBackground(Color.WHITE); } for (ScalableLabel[] labels : shido) { for (ScalableLabel label : labels) { label.setForeground(Color.BLACK); label.setBackground(Color.WHITE); } } Color mainBg; Color mainFg; switch (model.getMode()) { case FIGHTING: if (!model.isHolddownActivated()) { mainBg = colors.getColor(Area.FIGHTING_BACKGROUND); mainFg = colors.getColor(Area.FIGHTING_FOREGROUND); } else { mainBg = colors.getColor(Area.HOLDDOWN_BACKGROUND); mainFg = colors.getColor(Area.HOLDDOWN_FOREGROUND); } break; default: mainBg = colors.getColor(Area.IDLE_BACKGROUND); mainFg = colors.getColor(Area.IDLE_FOREGROUND); break; } setBackground(mainBg); setForeground(mainFg); for (Component c : new Component[] { noFightLayer, pendingFightLayer, vsLayer, pendingPlayer[0], pendingPlayer[1], pendingFightTimer[0], pendingFightTimer[1] }) { c.setBackground(mainBg); c.setForeground(mainFg); } for (int i = 0; i < 2; i++) { int playerPnt = swapPlayers ? (1 - i) : i; Color fg = colors.getColor((playerPnt == 0) ? Area.PLAYER1_FOREGROUND : Area.PLAYER2_FOREGROUND); Color bg = colors.getColor((playerPnt == 0) ? Area.PLAYER1_BACKGROUND : Area.PLAYER2_BACKGROUND); for (Component c : Arrays.asList(player[i], team[i], playerBackground[i], pendingFightTimer[i], pendingPlayer[i], vsPlayer[playerPnt])) { c.setForeground(fg); c.setBackground(bg); } for (int j = 0; j < 2; j++) { score[i][j].setForeground(fg); score[i][j].setBackground(bg); pendingScores[i][j].setForeground(fg); pendingScores[i][j].setBackground(bg); } } for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { scoreLabels[i][j].setBackground(mainBg); scoreLabels[i][j].setForeground(mainFg); scoreLabels[i][j].setBorder(new EmptyBorder(0, 0, 0, 0)); } } // Special colours for IJF if (this.scoreboardLayout instanceof IJFScoreboardLayout) { clearBackground(timer); timerBackground.setBackground(Color.BLACK); timer.setForeground(model.getMode() == Mode.FIGHTING ? Color.GREEN : Color.RED); for (ScalableLabel[] ls : score) { for (ScalableLabel l : ls) { clearBackground(l); } } for (int i = 0; i < 2; i++) { clearBackground(player[i], team[i]); } } }
From source file:captureplugin.CapturePlugin.java
/** * Check the programs after data update. */// w w w . j a va 2 s . co m public void handleTvDataUpdateFinished() { mNeedsUpdate = true; if (mAllowedToShowDialog) { mNeedsUpdate = false; DeviceIf[] devices = mConfig.getDeviceArray(); final DefaultTableModel model = new DefaultTableModel() { public boolean isCellEditable(int row, int column) { return false; } }; model.setColumnCount(5); model.setColumnIdentifiers(new String[] { mLocalizer.msg("device", "Device"), Localizer.getLocalization(Localizer.I18N_CHANNEL), mLocalizer.msg("date", "Date"), ProgramFieldType.START_TIME_TYPE.getLocalizedName(), ProgramFieldType.TITLE_TYPE.getLocalizedName() }); JTable table = new JTable(model); table.getTableHeader().setReorderingAllowed(false); table.getTableHeader().setResizingAllowed(false); table.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer() { public Component getTableCellRendererComponent(JTable renderTable, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = super.getTableCellRendererComponent(renderTable, value, isSelected, hasFocus, row, column); if (value instanceof DeviceIf) { if (((DeviceIf) value).getDeleteRemovedProgramsAutomatically() && !isSelected) { c.setForeground(Color.red); } } return c; } }); int[] columnWidth = new int[5]; for (int i = 0; i < columnWidth.length; i++) { columnWidth[i] = UiUtilities.getStringWidth(table.getFont(), model.getColumnName(i)) + 10; } for (DeviceIf device : devices) { Program[] deleted = device.checkProgramsAfterDataUpdateAndGetDeleted(); if (deleted != null && deleted.length > 0) { for (Program p : deleted) { if (device.getDeleteRemovedProgramsAutomatically() && !p.isExpired() && !p.isOnAir()) { device.remove(UiUtilities.getLastModalChildOf(getParentFrame()), p); } else { device.removeProgramWithoutExecution(p); } if (!p.isExpired()) { Object[] o = new Object[] { device, p.getChannel().getName(), p.getDateString(), p.getTimeString(), p.getTitle() }; for (int i = 0; i < columnWidth.length; i++) { columnWidth[i] = Math.max(columnWidth[i], UiUtilities.getStringWidth(table.getFont(), o[i].toString()) + 10); } model.addRow(o); } } } device.getProgramList(); } if (model.getRowCount() > 0) { int sum = 0; for (int i = 0; i < columnWidth.length; i++) { table.getColumnModel().getColumn(i).setPreferredWidth(columnWidth[i]); if (i < columnWidth.length - 1) { table.getColumnModel().getColumn(i).setMaxWidth(columnWidth[i]); } sum += columnWidth[i]; } JScrollPane scrollPane = new JScrollPane(table); scrollPane.setPreferredSize(new Dimension(450, 250)); if (sum > 500) { table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); scrollPane.getViewport().setPreferredSize( new Dimension(sum, scrollPane.getViewport().getPreferredSize().height)); } JButton export = new JButton(mLocalizer.msg("exportList", "Export list")); export.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setDialogType(JFileChooser.SAVE_DIALOG); chooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || f.toString().toLowerCase().endsWith(".txt"); } public String getDescription() { return "*.txt"; } }); chooser.setSelectedFile(new File("RemovedPrograms.txt")); if (chooser.showSaveDialog( UiUtilities.getLastModalChildOf(getParentFrame())) == JFileChooser.APPROVE_OPTION) { if (chooser.getSelectedFile() != null) { String file = chooser.getSelectedFile().getAbsolutePath(); if (!file.toLowerCase().endsWith(".txt") && file.indexOf('.') == -1) { file = file + ".txt"; } if (file.indexOf('.') != -1) { try { RandomAccessFile write = new RandomAccessFile(file, "rw"); write.setLength(0); String eolStyle = File.separator.equals("/") ? "\n" : "\r\n"; for (int i = 0; i < model.getRowCount(); i++) { StringBuilder line = new StringBuilder(); for (int j = 0; j < model.getColumnCount(); j++) { line.append(model.getValueAt(i, j)).append(' '); } line.append(eolStyle); write.writeBytes(line.toString()); } write.close(); } catch (Exception ee) { } } } } } }); Object[] message = { mLocalizer.msg("deletedText", "The data was changed and the following programs were deleted:"), scrollPane, export }; JOptionPane pane = new JOptionPane(); pane.setMessage(message); pane.setMessageType(JOptionPane.PLAIN_MESSAGE); final JDialog d = pane.createDialog(UiUtilities.getLastModalChildOf(getParentFrame()), mLocalizer.msg("CapturePlugin", "CapturePlugin") + " - " + mLocalizer.msg("deletedTitle", "Deleted programs")); d.setResizable(true); d.setModal(false); SwingUtilities.invokeLater(new Runnable() { public void run() { d.setVisible(true); } }); } } }
From source file:dataviewer.DataViewer.java
private void renderData(DefaultTableModel model) { tb_data.setVisible(false);/*from w w w. ja v a2 s . com*/ tb_data.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); c.setBackground(row % 2 == 0 ? Color.WHITE : new Color(240, 240, 240)); if (table.isCellSelected(row, column)) { c.setBackground(new Color(200, 0, 0)); c.setForeground(Color.white); } else if (table.isRowSelected(row)) { c.setBackground(new Color(0, 0, 200)); c.setForeground(Color.white); } else { c.setForeground(Color.black); } return c; } }); tb_data.setGridColor(new Color(220, 220, 220)); tb_data.setShowVerticalLines(true); tb_data.setModel(model); for (int i = 0; i < model.getColumnCount(); ++i) { if (model.getColumnName(i).equals("_N_")) { TableRowSorter trs = new TableRowSorter(model); trs.setComparator(i, new IntComparator()); tb_data.setRowSorter(trs); } } for (int j = 0; j < tb_data.getColumnCount(); j++) { int width = 0; TableColumn col = tb_data.getColumnModel().getColumn(j); TableCellRenderer renderer = tb_data.getTableHeader().getDefaultRenderer(); Component comp = renderer.getTableCellRendererComponent(tb_data, col.getHeaderValue(), false, false, 0, 0); width = Math.max(comp.getPreferredSize().width, width); for (int i = 0; i < tb_data.getRowCount(); i++) { renderer = tb_data.getCellRenderer(i, j); comp = tb_data.prepareRenderer(renderer, i, j); width = Math.max(comp.getPreferredSize().width, width); } tb_data.getColumnModel().getColumn(j).setPreferredWidth(width + 20); } tb_data.setVisible(true); }
From source file:com.raddle.tools.MergeMain.java
private void setCellRenderer(JList list) { list.setCellRenderer(new DefaultListCellRenderer() { private static final long serialVersionUID = 1L; @Override//from ww w . ja v a2 s. c om public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value != null) { PropertyLine line = (PropertyLine) value; boolean isInSelected = false; for (int selectedIndex : list.getSelectedIndices()) { if (index == selectedIndex) { isInSelected = true; } } if (!isInSelected) { if (CompareResult.extra == line.getCompareResult()) { c.setBackground(new Color(0xFFC48E)); } else if (CompareResult.different == line.getCompareResult()) { c.setBackground(new Color(0xBBBBFF)); } } if (line.getState() != null) { if (LineState.added == line.getState()) { c.setForeground(new Color(0xCC0033)); } else if (LineState.updated == line.getState()) { c.setForeground(new Color(0x0066CC)); } else if (LineState.deleted == line.getState()) { if (line.getOriginalValue() == null) { c.setForeground(new Color(0xAAAAAA)); } else { c.setForeground(new Color(0x666666)); } Map<Attribute, Object> map = new HashMap<Attribute, Object>(); map.put(TextAttribute.FONT, c.getFont()); map.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON); c.setFont(Font.getFont(map)); } } } return c; } }); }
From source file:dbseer.gui.user.DBSeerDataSet.java
protected Object readResolve() { useDefaultIfNull();/*from w w w.j a va 2 s . c o m*/ Boolean[] trueFalse = { Boolean.TRUE, Boolean.FALSE }; JComboBox trueFalseBox = new JComboBox(trueFalse); final DefaultCellEditor dce = new DefaultCellEditor(trueFalseBox); uniqueVariableName = "dataset_" + UUID.randomUUID().toString().replace('-', '_'); tableModel = new DBSeerDataSetTableModel(null, new String[] { "Name", "Value" }, true); tableModel.addTableModelListener(this); table = new JTable(tableModel) { @Override public TableCellEditor getCellEditor(int row, int col) { if ((row == DBSeerDataSet.TYPE_USE_ENTIRE_DATASET || row > TYPE_NUM_TRANSACTION_TYPE + numTransactionTypes) && col == 1) return dce; return super.getCellEditor(row, col); } }; DefaultTableCellRenderer customRenderer = new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b2, int row, int col) { Component cell = super.getTableCellRendererComponent(jTable, o, b, b2, row, col); if (row == DBSeerDataSet.TYPE_START_INDEX || row == DBSeerDataSet.TYPE_END_INDEX) { if (((Boolean) table.getValueAt(DBSeerDataSet.TYPE_USE_ENTIRE_DATASET, 1)) .booleanValue() == true) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } } else if (row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } return cell; } }; table.getColumnModel().getColumn(0).setCellRenderer(customRenderer); table.getColumnModel().getColumn(1).setCellRenderer(customRenderer); table.setFillsViewportHeight(true); table.getColumnModel().getColumn(0).setMaxWidth(400); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setPreferredWidth(600); table.setRowHeight(20); for (String header : tableHeaders) { if (header.equalsIgnoreCase("Use Entire DataSet")) tableModel.addRow(new Object[] { header, Boolean.TRUE }); else tableModel.addRow(new Object[] { header, "" }); } for (int i = 0; i < transactionTypes.size(); ++i) { DBSeerTransactionType txType = transactionTypes.get(i); tableModel.addRow(new Object[] { "Name of Transaction Type " + (i + 1), txType.getName() }); } if (live) { updateLiveDataSet(); } for (int i = 0; i < transactionTypes.size(); ++i) { DBSeerTransactionType txType = transactionTypes.get(i); if (txType.isEnabled()) { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.TRUE }); } else { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.FALSE }); } } this.updateTable(); dataSetLoaded = false; tableModel.setUseEntireDataSet(this.useEntireDataSet.booleanValue()); return this; }
From source file:dbseer.gui.user.DBSeerDataSet.java
public DBSeerDataSet() { live = new Boolean(false); Boolean[] trueFalse = { Boolean.TRUE, Boolean.FALSE }; JComboBox trueFalseBox = new JComboBox(trueFalse); final DefaultCellEditor dce = new DefaultCellEditor(trueFalseBox); uniqueVariableName = "dataset_" + UUID.randomUUID().toString().replace('-', '_'); uniqueModelVariableName = "mv_" + UUID.randomUUID().toString().replace('-', '_'); name = "Unnamed dataset"; tableModel = new DBSeerDataSetTableModel(null, new String[] { "Name", "Value" }, true); tableModel.addTableModelListener(this); table = new JTable(tableModel) { @Override/*from w w w . ja v a2 s . c o m*/ public TableCellEditor getCellEditor(int row, int col) { if ((row == DBSeerDataSet.TYPE_USE_ENTIRE_DATASET || row > TYPE_NUM_TRANSACTION_TYPE + numTransactionTypes) && col == 1) return dce; return super.getCellEditor(row, col); } }; DefaultTableCellRenderer customRenderder = new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b2, int row, int col) { Component cell = super.getTableCellRendererComponent(jTable, o, b, b2, row, col); if (row == DBSeerDataSet.TYPE_START_INDEX || row == DBSeerDataSet.TYPE_END_INDEX) { if (((Boolean) table.getValueAt(DBSeerDataSet.TYPE_USE_ENTIRE_DATASET, 1)) .booleanValue() == true) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } } else if (row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } return cell; } }; table.getColumnModel().getColumn(0).setCellRenderer(customRenderder); table.getColumnModel().getColumn(1).setCellRenderer(customRenderder); table.setFillsViewportHeight(true); table.getColumnModel().getColumn(0).setMaxWidth(400); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setPreferredWidth(600); table.setRowHeight(20); this.useEntireDataSet = true; for (String header : tableHeaders) { if (header.equalsIgnoreCase("Use Entire DataSet")) tableModel.addRow(new Object[] { header, Boolean.TRUE }); else tableModel.addRow(new Object[] { header, "" }); } for (int i = 0; i < numTransactionTypes; ++i) { tableModel.addRow(new Object[] { "Name of Transaction Type " + (i + 1), "Type " + (i + 1) }); DBSeerTransactionType type = new DBSeerTransactionType("Type " + (i + 1), true); transactionTypes.add(type); } for (int i = 0; i < transactionTypes.size(); ++i) { DBSeerTransactionType txType = transactionTypes.get(i); if (txType.isEnabled()) { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.TRUE }); } else { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.FALSE }); } } this.updateTable(); dataSetLoaded = false; isCurrent = false; tableModel.setUseEntireDataSet(this.useEntireDataSet.booleanValue()); }
From source file:dbseer.gui.user.DBSeerDataSet.java
public DBSeerDataSet(boolean isLive) { live = new Boolean(isLive); Boolean[] trueFalse = { Boolean.TRUE, Boolean.FALSE }; JComboBox trueFalseBox = new JComboBox(trueFalse); final DefaultCellEditor dce = new DefaultCellEditor(trueFalseBox); uniqueVariableName = "dataset_" + UUID.randomUUID().toString().replace('-', '_'); uniqueModelVariableName = "mv_" + UUID.randomUUID().toString().replace('-', '_'); if (isLive) { name = "Live Data"; }/* w w w.ja va 2s . com*/ tableModel = new DBSeerDataSetTableModel(null, new String[] { "Name", "Value" }, !isLive); tableModel.addTableModelListener(this); table = new JTable(tableModel) { @Override public TableCellEditor getCellEditor(int row, int col) { if ((row == DBSeerDataSet.TYPE_USE_ENTIRE_DATASET || row > TYPE_NUM_TRANSACTION_TYPE + numTransactionTypes) && col == 1) return dce; return super.getCellEditor(row, col); } }; DefaultTableCellRenderer customRenderder = new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b2, int row, int col) { Component cell = super.getTableCellRendererComponent(jTable, o, b, b2, row, col); if (row == DBSeerDataSet.TYPE_START_INDEX || row == DBSeerDataSet.TYPE_END_INDEX) { if (((Boolean) table.getValueAt(DBSeerDataSet.TYPE_USE_ENTIRE_DATASET, 1)) .booleanValue() == true) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } } // else if (row == DBSeerDataSet.TYPE_AVERAGE_LATENCY || // row == DBSeerDataSet.TYPE_HEADER || // row == DBSeerDataSet.TYPE_MONITORING_DATA || // row == DBSeerDataSet.TYPE_PERCENTILE_LATENCY || // row == DBSeerDataSet.TYPE_TRANSACTION_COUNT || // row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE || // row == DBSeerDataSet.TYPE_STATEMENT_FILE || // row == DBSeerDataSet.TYPE_QUERY_FILE || // row == DBSeerDataSet.TYPE_TRANSACTION_FILE) else if (row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } return cell; } }; table.getColumnModel().getColumn(0).setCellRenderer(customRenderder); table.getColumnModel().getColumn(1).setCellRenderer(customRenderder); table.setFillsViewportHeight(true); table.getColumnModel().getColumn(0).setMaxWidth(400); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setPreferredWidth(600); table.setRowHeight(20); this.useEntireDataSet = true; for (String header : tableHeaders) { if (header.equalsIgnoreCase("Use Entire DataSet")) tableModel.addRow(new Object[] { header, Boolean.TRUE }); else tableModel.addRow(new Object[] { header, "" }); } this.updateLiveDataSet(); for (int i = 0; i < numTransactionTypes; ++i) { tableModel.addRow(new Object[] { "Name of Transaction Type " + (i + 1), "Type " + (i + 1) }); DBSeerTransactionType type = new DBSeerTransactionType("Type " + (i + 1), true); transactionTypes.add(type); } for (int i = 0; i < transactionTypes.size(); ++i) { DBSeerTransactionType txType = transactionTypes.get(i); if (txType.isEnabled()) { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.TRUE }); } else { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.FALSE }); } } this.updateTable(); dataSetLoaded = false; tableModel.setUseEntireDataSet(this.useEntireDataSet.booleanValue()); }
From source file:com.jtstand.swing.StatsPanel.java
private void showStatisticsTable() { StatsTableModel tm = new StatsTableModel(this, allstat, catstats); jTable.setModel(tm);// w w w . ja va 2 s .c om jTable.setBackground(Color.white); //... // resizeSeries(); //((ColumnHeaderRenderer) jTable.getTableHeader().getDefaultRenderer()).setHorizontalAlignment(SwingConstants.CENTER); jTable.addHighlighter(new Highlighter() { public Component highlight(Component c, ComponentAdapter ca) { if (JLabel.class.isAssignableFrom(c.getClass())) { ((JLabel) c).setHorizontalAlignment(SwingConstants.CENTER); int column = jTable.convertColumnIndexToModel(ca.column); if (column == StatsTableModel.StatsTableColumn.CATEGORY.ordinal()) { if (jTable.getRowCount() > 1) { int i = jTable.convertRowIndexToModel(ca.row); if (i > 0) { c.setForeground(ChartCategories.getColor(i - 1)); } } else { if (isCategorization() && !isMultipleCategorization()) { c.setForeground(ChartCategories.getColor(0)); } } } } return c; } public void addChangeListener(ChangeListener arg0) { } public void removeChangeListener(ChangeListener arg0) { } public ChangeListener[] getChangeListeners() { return new ChangeListener[0]; } }); DecimalFormat df = null; if (testStepInstances.getReferenceStep() != null) { String decFormatStr = testStepInstances.getReferenceStep() .getPropertyString(TestStepInstance.STR_DECIMAL_FORMAT, null); if (decFormatStr != null) { df = new DecimalFormat(decFormatStr); } } jTable.setDefaultRenderer(Double.class, new StatsTableRendererDouble(df)); //this.jTableSeries.invalidate(); Util.packColumns(jTable, 9); // jTableSeries.setVisibleRowCount(Math.min(3, jTableSeries.getRowCount())); Util.setVisibleRowCount(jTable, Math.min(3, jTable.getRowCount()), jSplitPane); // Util.getRowCount(jTable, jSplitPane); // Util.setDividerLocation(jSplitPane, jTable); jSplitPane.setDividerLocation(-1); // jScrollPaneTop.invalidate(); // validateTree(); }
From source file:com.farouk.projectapp.FirstGUI.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*w w w . j a v a 2 s . c o m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); DefaultTableModel a = new DefaultTableModel(); jTable2 = new javax.swing.JTable() { public boolean isCellEditable(int d, int c) { return false; } @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int col) { Component comp = super.prepareRenderer(renderer, row, col); String value = getModel().getValueAt(row, 0).toString(); int a = SQLConnect.ifReported(userID, value); if (a == 1) { comp.setBackground(Color.red); } else { comp.setBackground(Color.white); comp.setForeground(Color.black); } return comp; } }; jButton5 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jSeparator2 = new javax.swing.JSeparator(); jButton10 = new javax.swing.JButton(); jLabel10 = new javax.swing.JLabel(); jPanel15 = new javax.swing.JPanel(); jPanel16 = new javax.swing.JPanel(); jTextField6 = new javax.swing.JTextField(); jTextField7 = new javax.swing.JTextField(); jLabel14 = new javax.swing.JLabel(); jButton13 = new javax.swing.JButton(); jButton14 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jPanel10 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); jEditorPane1 = new javax.swing.JEditorPane(); jButton15 = new javax.swing.JButton(); jButton19 = new javax.swing.JButton(); jTextField4 = new javax.swing.JTextField(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jPanel3 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); jScrollPane5 = new javax.swing.JScrollPane(); jTable3 = new javax.swing.JTable() { public boolean isCellEditable(int d, int c) { return false; } }; jButton6 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jPanel8 = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollPane(); DefaultListModel modelCompaniesName = new DefaultListModel(); try { for (String p : SQLConnect.getAllCompaniesNames()) { modelCompaniesName.addElement(p); } } catch (Exception e) { e.printStackTrace(); } jList1 = new javax.swing.JList(); jLabel3 = new javax.swing.JLabel(); jButton4 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); jLabel9 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jButton8 = new javax.swing.JButton(); jPanel7 = new javax.swing.JPanel(); jTextField2 = new javax.swing.JTextField(); jPasswordField1 = new javax.swing.JPasswordField(); jButton11 = new javax.swing.JButton(); jButton12 = new javax.swing.JButton(); jPanel9 = new javax.swing.JPanel(); jLabel11 = new javax.swing.JLabel(); jButton17 = new javax.swing.JButton(); jLabel12 = new javax.swing.JLabel(); jButton18 = new javax.swing.JButton(); jTextField3 = new javax.swing.JTextField(); jLabel15 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItem2 = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTabbedPane1.setToolTipText(""); jTabbedPane1.setMinimumSize(new java.awt.Dimension(150, 200)); jTabbedPane1.setPreferredSize(new java.awt.Dimension(200, 200)); jScrollPane1.setViewportView(jTable2); jTable2.setModel(a); try { UpdatejTable2(); } catch (Exception e) { e.printStackTrace(); } jTable2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTable2MouseClicked(evt); } }); jTable2.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { jTable2KeyReleased(evt); } }); jScrollPane1.setViewportView(jTable2); jButton5.setText("Refresh My Portfolio"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jLabel4.setText(" Last Refreshed : "); jButton10.setText("Refresh Company"); jButton10.setVisible(false); jButton10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton10ActionPerformed(evt); } }); jLabel10.setText("Total is : " + String.valueOf(total.doubleValue()) + ""); jTextField6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField6ActionPerformed(evt); } }); jTextField6.setVisible(false); jTextField7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField7ActionPerformed(evt); } }); jLabel14.setText("N of Actions"); javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16); jPanel16.setLayout(jPanel16Layout); jPanel16Layout.setHorizontalGroup(jPanel16Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup() .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup() .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(34, 34, 34).addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel14)) .addGap(0, 3, Short.MAX_VALUE))); jPanel16Layout.setVerticalGroup(jPanel16Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup() .addComponent(jLabel14) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(13, 13, 13))); jButton13.setText("Buy"); jButton13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton13ActionPerformed(evt); } }); jButton14.setText("Sell"); jButton14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton14ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15); jPanel15.setLayout(jPanel15Layout); jPanel15Layout .setHorizontalGroup( jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup().addComponent(jButton13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton14).addGap(166, 166, 166)) .addGroup(jPanel15Layout.createSequentialGroup() .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel15Layout .setVerticalGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel15Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton14).addComponent(jButton13)))); jButton7.setText("Get News !"); jButton7.setVisible(false); jButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton7ActionPerformed(evt); } }); jButton3.setText("Report"); jButton3.setVisible(false); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel10.setVisible(false); jScrollPane2.setViewportView(jEditorPane1); javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); jPanel10.setLayout(jPanel10Layout); jPanel10Layout.setHorizontalGroup( jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( jPanel10Layout.createSequentialGroup().addGap(39, 39, 39).addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 423, Short.MAX_VALUE))); jPanel10Layout.setVerticalGroup(jPanel10Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel10Layout .createSequentialGroup().addContainerGap().addComponent(jScrollPane2).addContainerGap())); jButton15.setText("Automate"); jButton15.setVisible(false); jButton15.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton15ActionPerformed(evt); } }); jButton19.setText("Alert"); jButton19.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton19ActionPerformed(evt); } }); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap().addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1) .addGroup(jPanel6Layout.createSequentialGroup().addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel6Layout.createSequentialGroup().addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jButton19, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton3).addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel6Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() .addGroup(jPanel6Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel10) .addComponent(jButton10)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel6Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton5) .addComponent(jLabel4))) .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel6Layout.createSequentialGroup().addGap(70, 70, 70) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 419, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap())); jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { jButton3, jTextField4 }); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addComponent(jButton7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton15).addComponent(jButton3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel6Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton19) .addGroup(jPanel6Layout.createSequentialGroup().addGap(1, 1, 1) .addComponent(jTextField4))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(9, 9, 9)) .addGroup(jPanel6Layout.createSequentialGroup() .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel6Layout.createSequentialGroup() .addGroup(jPanel6Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton5).addComponent(jButton10)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel6Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4).addComponent(jLabel10)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())))); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); jTabbedPane1.addTab(" My Portfolio ", jPanel5); jTextField1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jButton1.setText("Search"); jButton1.setAlignmentY(0.3F); jButton1.setAutoscrolls(true); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Clear"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addGap(2, 2, 2) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jButton2) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2)) .addContainerGap())); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(51, 51, 51))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField1).addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jLabel1.setText("Name of Company to look for : "); jTable3.setModel(a); jScrollPane5.setViewportView(jTable3); jScrollPane5.setVisible(false); jButton6.setText("Refresh Company"); jButton6.setVisible(false); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jLabel2.setText(null); jLabel2.setVisible(false); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane5) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2).addComponent(jButton6)))) .addContainerGap())); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup().addGap(5, 5, 5).addComponent(jButton6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(19, 19, 19))); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup().addGap(82, 82, 82) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1).addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 598, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 236, Short.MAX_VALUE))) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(36, 36, 36).addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(210, Short.MAX_VALUE))); jTabbedPane1.addTab(" Search ", jPanel1); jList1.setModel(modelCompaniesName); jList1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jList1MouseClicked(evt); } }); jScrollPane3.setViewportView(jList1); jLabel3.setText(" List of Companies (NASDAQ)"); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout .setHorizontalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(jPanel8Layout.createSequentialGroup().addComponent(jLabel3).addGap(0, 50, Short.MAX_VALUE))); jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup().addGap(5, 5, 5).addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent( jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 613, Short.MAX_VALUE))); jButton4.setText("Refresh All"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jButton9.setVisible(false); jButton9.setText("Quit"); jButton9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton9ActionPerformed(evt); } }); jLabel9.setText("All prices are in ."); jLabel8.setVisible(false); jButton8.setText("Stop"); jButton8.setVisible(false); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); jPasswordField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jPasswordField1ActionPerformed(evt); } }); jButton11.setText("Log in"); jButton11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton11ActionPerformed(evt); } }); jButton12.setText("Create account"); jButton12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton12ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout .setHorizontalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { jPasswordField1, jTextField2 }); jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { jButton11, jButton12 }); jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton12).addContainerGap())); jPanel7Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { jPasswordField1, jTextField2 }); jLabel11.setFont(new java.awt.Font("Tahoma", 0, 17)); // NOI18N jButton17.setText("Log out"); jButton17.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton17ActionPerformed(evt); } }); jButton18.setText("Change Limit"); jButton18.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton18ActionPerformed(evt); } }); jTextField3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField3ActionPerformed(evt); } }); jPanel9.setVisible(false); javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup(jPanel9Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup() .addContainerGap(18, Short.MAX_VALUE) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel9Layout.createSequentialGroup() .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton18)) .addGroup(jPanel9Layout.createSequentialGroup() .addGroup(jPanel9Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup().addComponent(jLabel11) .addGap(30, 30, 30)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup().addComponent(jLabel12) .addGap(18, 18, 18))) .addComponent(jButton17))) .addGap(36, 36, 36))); jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup().addComponent(jLabel11) .addGap(18, 18, 18).addComponent(jLabel12)) .addComponent(jButton17)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton18).addGroup(jPanel9Layout.createSequentialGroup() .addGap(1, 1, 1).addComponent(jTextField3))) .addContainerGap())); jLabel6.setVisible(false); jMenu1.setText("File"); jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem1.setText("Quit"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenuBar1.add(jMenu1); jMenu2.setText("Help"); jMenuItem2.setText("About"); jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu2.add(jMenuItem2); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup().addComponent(jButton4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton8))) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel8).addGap(85, 85, 85).addComponent(jLabel7) .addGap(77, 77, 77).addComponent(jButton9)) .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 931, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup().addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(53, 53, 53).addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18)) .addGroup(layout.createSequentialGroup().addComponent(jLabel15) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton9).addComponent(jButton4).addComponent(jLabel8) .addComponent(jButton8).addComponent(jLabel6).addComponent(jLabel7)) .addContainerGap()) .addGroup(layout.createSequentialGroup().addGap(16, 16, 16).addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(68, 68, 68) .addComponent(jLabel9)) .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 515, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel15) .addGap(0, 0, Short.MAX_VALUE))); jTabbedPane1.getAccessibleContext().setAccessibleName(""); pack(); }
From source file:semaforo.Semaforo.java
public Component getTableCellRendererComponentCell(JTable table, Color color, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cellComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);/* ww w. j a va 2 s.c om*/ cellComponent.setBackground(color); cellComponent.setForeground(color); return cellComponent; }