/** * Constructor de la clase, crea la tabla y de da todas las propiedades para mostrarla en la * aplicacion. */ public PanelHojaCalculo() { modelo = new ModeloTabla(); columnasTabla = new ModeloColumnasTabla(); tabla = new JTable(modelo, columnasTabla); tablaAux = new JTable(modelo, filasTabla); tabla.createDefaultColumnsFromModel(); tablaAux.createDefaultColumnsFromModel(); tabla.setColumnSelectionAllowed(true); tabla.setRowSelectionAllowed(true); tablaAux.setSelectionModel(tabla.getSelectionModel()); tablaAux.setMaximumSize(new Dimension(40, 10000)); tablaAux.setBackground(new Color(238, 238, 238)); // Se puede pasar a true si se quiere seleccionar las filas tablaAux.setEnabled(false); tablaAux.setColumnSelectionAllowed(false); tablaAux.setCellSelectionEnabled(false); viewPort = new JViewport(); viewPort.setView(tablaAux); viewPort.setPreferredSize(tablaAux.getMaximumSize()); tabla.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); tablaAux.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); scrollPane = new JScrollPane(tabla); scrollPane.setRowHeader(viewPort); scrollPane.setPreferredSize(new Dimension(790, 500)); add(scrollPane); }
/** * Fügt einem Container eine JTable mit den Daten, der Beschriftung und dem Titel hinzu. * * @param tabs JTabbedPane * @param daten Daten * @param kopfZeile Beschriftung * @param s Titel */ protected static void fuegeJTabelleHinzu( Container tabs, Object[][] daten, Object[] kopfZeile, String s) { TableModel model = new DefaultTableModel(daten, kopfZeile) { private static final long serialVersionUID = 1L; @SuppressWarnings({"rawtypes", "unchecked"}) @Override public Class getColumnClass(int column) { return getValueAt(0, column).getClass(); } }; JTable jTabelle = new JTable(model); jTabelle.getTableHeader().setFont(DiagrammeErsteller.STANDARD2); jTabelle.setFont(DiagrammeErsteller.STANDARD3); jTabelle.setEnabled(false); jTabelle.getTableHeader().setReorderingAllowed(false); RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model); jTabelle.setRowSorter(sorter); if (tabs.getClass() == JTabbedPane.class) { JTabbedPane t = (JTabbedPane) tabs; t.addTab( s, new JScrollPane( jTabelle, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)); } else { tabs.add(new JScrollPane(jTabelle)); } }
public void setEnabled(boolean arg0) { table.setEnabled(arg0); table.clearSelection(); add.setEnabled(arg0); edit.setEnabled(false); remove.setEnabled(false); }
public static void buscaPorNome(String nome) { JTable tabela = new JTable(); ArrayList<Voluntario> voluntarios = new ArrayList<Voluntario>(); for (Voluntario v : voluntarioDAO.listarVoluntario()) { if (v.getNome().equalsIgnoreCase(nome)) { voluntarios.add(v); } } String[] colunas = { "Matrícula", "Nome", "Telefone", "Celular", "Email", "Endereço", "Sexo", "Login", "Senha", "Nascimento", "Religiao", "RG" }; ModeloJTable modelo = new ModeloJTable(colunas, voluntarios); tabela.setModel(modelo); tabela.setEnabled(false); TelaSelecaoBusca.mostrarResultadoTabela(tabela); }
public void unGreyTable() { sitesTable.setSelectionBackground(oldSelectionBackground); sitesTable.setSelectionForeground(oldSelectionForeground); sitesTable.setForeground(Color.BLACK); sitesTable.setBackground(Color.WHITE); sitesTable.setEnabled(true); }
private void table() { table = new JTable(); table.setShowVerticalLines(false); table.setEnabled(false); model = new DefaultTableModel( new Object[][] {}, new String[] {"Bar kod", "Naziv", "Cena", "Kategorija", "Količina"}); table.setModel(model); table.setBounds(10, 110, 500, 350); Iterator<Artikal> artikli = snabdevac.getArtikli().iterator(); // Popunjavanje tabele while (artikli.hasNext()) { Artikal a = artikli.next(); String[] s = new String[] { String.valueOf(a.getBarKod()), a.getNaziv(), String.valueOf((a.getCena() - a.getPopust())), a.getKategorija(), String.valueOf(a.getKolicina()) }; model.addRow(s); } layeredPane.add(table); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBounds(10, 110, 500, 350); layeredPane.add(scrollPane); }
private void init() { agents = new JComboBox(model); agents.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { stateChanged(event); } }); agents.addActionListener(TextChangesListener.getInstance()); ctm = new CreationTableModel(); datatable = new JTable(ctm); datatable.setShowGrid(false); datatable.setEnabled(false); datatable.setTableHeader(null); datatable.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3)); JPanel apanel = new JPanel(new BorderLayout()); apanel.add(new JLabel("Who took the photo: "), BorderLayout.WEST); apanel.add(agents, BorderLayout.CENTER); JPanel tablePanel = new JPanel(new BorderLayout()); tablePanel.add(new JScrollPane(datatable), BorderLayout.CENTER); datatable.getColumnModel().getColumn(0).setMaxWidth(120); datatable.getColumnModel().getColumn(0).setMinWidth(80); datatable.addKeyListener(TextChangesListener.getInstance()); this.add( ComponentFactory.createTitledPanel("Creator of the image:", apanel), BorderLayout.NORTH); this.add( ComponentFactory.createTitledPanel("Creation, EXIF & technical information:", tablePanel), BorderLayout.CENTER); this.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.WEST); }
/** * Shows given list of reading lists. * * @param lists lists. */ protected void setReadingLists(ReadingList[] lists) { tblReadingLists.setEnabled(lists != null); btnAddReadingList.setEnabled(lists != null); btnRemoveList.setEnabled(lists != null); readingListsModel.setLists(lists); }
public PretragaProzor(String pretraga, String vrednost) { super(615, 540); table = new JTable(); table.setShowVerticalLines(false); table.setEnabled(false); model = new DefaultTableModel( new Object[][] {}, new String[] {"Bar kod", "Naziv", "Cena", "Popust", "Kategorija", "Količina"}); table.setModel(model); table.setBounds(0, 0, 600, 500); layeredPane.add(table); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBounds(0, 0, 600, 500); layeredPane.add(scrollPane); ArrayList<Artikal> artikli = (ArrayList<Artikal>) Artikal.ucitajSve(pretraga + vrednost); for (int i = 0; i < artikli.size(); i++) { String[] artikalString = new String[] { String.valueOf(artikli.get(i).getBarKod()), artikli.get(i).getNaziv(), String.valueOf(artikli.get(i).getCena()), String.valueOf(artikli.get(i).getPopust()), artikli.get(i).getKategorija(), String.valueOf(artikli.get(i).getKolicina()) }; model.addRow(artikalString); } }
public KeHuChaXun() { super(); setIconifiable(true); setClosable(true); setTitle("客户信息查询"); getContentPane().setLayout(new GridBagLayout()); setBounds(100, 100, 640, 375); table = new JTable(); table.setEnabled(false); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); String[] tableHeads = new String[] { "客户ID", "客户全称", "客户地址", "客户简称", "邮政编码", "电 话", "传 真", "联 系 人", "联系电话", "E-Mail", "开户银行", "银行账号" }; final DefaultTableModel dftm = (DefaultTableModel) table.getModel(); dftm.setColumnIdentifiers(tableHeads); final JScrollPane scrollPane = new JScrollPane(table); scrollPane.setAutoscrolls(true); final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints(); gridBagConstraints_6.weighty = 1.0; gridBagConstraints_6.insets = new Insets(0, 10, 5, 10); gridBagConstraints_6.fill = GridBagConstraints.BOTH; gridBagConstraints_6.gridwidth = 6; gridBagConstraints_6.gridy = 1; gridBagConstraints_6.gridx = 0; getContentPane().add(scrollPane, gridBagConstraints_6); setupComponet(new JLabel(" 选择查询条件:"), 0, 0, 1, 1, false); conditionBox1 = new JComboBox(); conditionBox1.setModel(new DefaultComboBoxModel(new String[] {"客户全称", "客户简称"})); setupComponet(conditionBox1, 1, 0, 1, 30, true); conditionBox2 = new JComboBox(); conditionBox2.setModel(new DefaultComboBoxModel(new String[] {"等于", "包含"})); setupComponet(conditionBox2, 2, 0, 1, 30, true); conditionContent = new JTextField(); setupComponet(conditionContent, 3, 0, 1, 140, true); final JButton queryButton = new JButton(); queryButton.addActionListener(new queryAction(dftm)); queryButton.setText("查询"); setupComponet(queryButton, 4, 0, 1, 1, false); showAllButton = new JButton(); showAllButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { conditionContent.setText(""); List list = Dao.getKhInfos(); updateTable(list, dftm); } }); setupComponet(showAllButton, 5, 0, 1, 1, false); showAllButton.setText("显示全部数据"); }
protected void build(StatisticsTableModel model) { infoTable = new JTable(model, new StatisticsTableColumnModel()); infoTable.setShowHorizontalLines(true); infoTable.setShowVerticalLines(false); infoTable.setEnabled(false); setLayout(new BorderLayout()); add(infoTable, BorderLayout.CENTER); }
private void loadStates() { boolean b = enableDefaultEncryption.isSelected(); cboSavpOption.setEnabled(b); this.encryptionProtocolPreferences.setEnabled(b); enableSipZrtpAttribute.setEnabled( b && this.encryptionConfigurationTableModel.isEnabledLabel("ZRTP")); tabCiphers.setEnabled(b && this.encryptionConfigurationTableModel.isEnabledLabel("SDES")); }
@Override public void vista_noedicion() { this.txtCodigo.setEditable(false); txtDescripcion.setEditable(false); this.txtDescCorta.setEditable(false); tblLista.setEnabled(true); getSubgrupoTM().setEditar(false); }
private void setDataTebleLockState(boolean b) { passwd.setText(""); unlock.setEnabled(b); lock.setEnabled(!b); if (b) { table.setEnabled(false); table.setBackground(Color.white); } else { table.setEnabled(true); table.setBackground(Color.yellow); JOptionPane.showMessageDialog( null, "Administration Mode Unlocked", "Administration Mode", JOptionPane.INFORMATION_MESSAGE); } }
@Override public void vista_edicion() { if (getEstado().equals(NUEVO)) txtCodigo.setEditable(true); txtDescripcion.setEditable(true); this.txtDescCorta.setEditable(true); tblLista.setEnabled(false); getSubgrupoTM().setEditar(true); }
public void setEnabled(boolean enabled) { addPropertyAction.setEnabled(enabled); removePropertyAction.setEnabled(enabled); propertiesTable.setEnabled(enabled); loadPropertiesAction.setEnabled(enabled); super.setEnabled(enabled); }
public hostelStatus() { setTitle("Hostel"); connect(); updateRecord(); JFrame fr = new JFrame(); Toolkit tkt = fr.getToolkit(); Dimension frsize = tkt.getScreenSize(); setBounds(frsize.width / 4, frsize.height / 12, frsize.width / 2, frsize.height / 8); setLayout(null); cn = getContentPane(); cn.setBackground(new Color(190, 180, 170)); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); tl = new JLabel("Current Hostels Status"); tl.setFont(new Font("Engravers MT", 1, 25)); tl.setForeground(new Color(247, 251, 249)); p1 = new JPanel(); p1.setBounds(0, 0, 600, 50); p1.add(tl); p1.setBackground(new Color(31, 88, 166)); cn.add(p1); b1 = new JButton("LOAD"); b1.setMnemonic('L'); b1.addActionListener(new dispListener()); b1.setBounds(230, 320, 120, 30); b2 = new JButton("EXIT"); b2.setMnemonic('X'); b2.addActionListener(new exitListener()); b2.setBounds(350, 320, 100, 30); cn.add(b1); cn.add(b2); table = new JTable(data, col); table.setFont(new Font("Serif", Font.BOLD, 16)); table.setBackground(new Color(250, 250, 250)); table.setEnabled(false); JScrollPane jsp = new JScrollPane(table); jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jsp.setBounds(5, 100, 590, 200); cn.add(jsp); screensize = Toolkit.getDefaultToolkit().getScreenSize(); setSize(600, 400); setVisible(true); setVisible(true); setResizable(true); connect(); }
@Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); _table.setEnabled(enabled); if (!enabled) { _table.clearSelection(); _table.editingCanceled(new ChangeEvent(_table)); } }
void greyOutTable() { sitesTable.setEnabled(false); oldSelectionBackground = sitesTable.getSelectionBackground(); oldSelectionForeground = sitesTable.getSelectionForeground(); sitesTable.setSelectionBackground(Color.GRAY); sitesTable.setSelectionForeground(Color.DARK_GRAY); sitesTable.setForeground(Color.GRAY); sitesTable.setBackground(null); }
private void toggleGUIElements(final boolean isEnabled) { propertyKeyTextField.setEnabled(isEnabled); propertyValueTextField.setEnabled(isEnabled); createPropertyServiceComboBox.setEnabled(isEnabled); createPropertyButton.setEnabled(isEnabled && isNonEmptyValidator.isValid(propertyKeyTextField)); viewPropertiesServiceComboBox.setEnabled(isEnabled); reloadPropertiesButton.setEnabled(isEnabled); propertiesTable.setEnabled(isEnabled); }
/** * This method initializes jTable * * @return javax.swing.JTable */ JTable getJTable() { if (jTable == null) { Event event = new Event(); AdministrateEventController controller = new AdministrateEventController(); event = controller.processRetrieve(); int colWidth = 100; Object[] colNames = {"Event ID", "Event Date", "Event Time", "Event Name", "Status"}; Object[][] data = new Object[event.getEventID_list().size()][colSize]; for (int i = 0; i < event.getEventID_list().size(); i++) { data[i][0] = event.getEventID_list().get(i); data[i][1] = controller.calendarToString(event.getEventDate_list().get(i)); data[i][2] = event.getEventTime_list().get(i); data[i][3] = event.getEventName_list().get(i); data[i][4] = event.getEventStatus_list().get(i); } model.setDataVector(data, colNames); jTable = new JTable(model); if (viewModel != null) { jTable.setModel(viewModel); viewModel = null; } jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); for (int i = 0; i < colSize; i++) { jTable.getColumnModel().getColumn(i).setCellRenderer(new Renderer()); jTable.getColumnModel().getColumn(i).setPreferredWidth(colWidth); } jTable.getColumnModel().getColumn(3).setPreferredWidth(250); jTable.getColumnModel().getColumn(4).setPreferredWidth(172); jTable.setAutoCreateColumnsFromModel(false); sortAllRowsBy(model, 0, true); jTable.setEnabled(false); JTableHeader header = jTable.getTableHeader(); header.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { JTableHeader h = (JTableHeader) e.getSource(); int nColumn = h.columnAtPoint(e.getPoint()); if (nColumn != -1) sortAllRowsBy(model, nColumn, true); } }); etbml = new EventTableButtonMouseListener(jTable, source, crudFf); etbml.setSelection(selection); jTable.addMouseListener(etbml); } return jTable; }
/** * Sets whether or not this component is enabled. It also does this for its children. * * @param enabled 'true' if this component and its children should be enabled, 'false' otherwise. */ public void setEnabled(boolean enabled) { super.setEnabled(enabled); Component[] components = getComponents(); for (int i = 0; i < components.length; i++) { components[i].setEnabled(enabled); } table.setEnabled(enabled); }
private JTable createRightWordTable() { if (rightTable == null) { rechteTabelle = new WordAnalysisTabTableModel(); rechteTabelle.addColumn("Wörter"); rechteTabelle.addColumn("Anzahl"); rightTable = new JTable(rechteTabelle); rightTable.setFocusable(false); rightTable.setEnabled(false); } return rightTable; }
public void deactivate() { indexNode.deregisterChatListenter(this); message.setEnabled(false); message.setText("You are no longer connected to this index node. No chats for you."); sendMessage.setEnabled(false); avatarTable.setEnabled(false); chatLog.setBackground(Color.lightGray); // Set status active = false; }
StatisticsInfoTable(StatisticsTableModel model) { JTable infoTable = new JTable( model, new TagTableColumnModelBuilder( new StatisticsInfoRenderer(), tr("Paste ..."), tr("From ..."), tr("To ...")) .build()); infoTable.setShowHorizontalLines(true); infoTable.setShowVerticalLines(false); infoTable.setEnabled(false); setLayout(new BorderLayout()); add(infoTable, BorderLayout.CENTER); }
private void enableControls() { loadSoundBtn.setEnabled(!running); addFromClipboardBtn.setEnabled(!running); addFromEditorBtn.setEnabled(!running); addFromDiscBtn.setEnabled(!running); randomCountIEd.setEnabled(!running); genRandFlamesBtn.setEnabled(!running); randomGenCmb.setEnabled(!running); boolean flameSelected = poolFlameHolder.getFlame() != null; flameToEditorBtn.setEnabled(flameSelected); deleteFlameBtn.setEnabled(flameSelected); renameFlameBtn.setEnabled(flameSelected); replaceFlameFromEditorBtn.setEnabled(flameSelected); framesPerSecondIEd.setEnabled(!running); borderSizeSlider.setEnabled(true); morphFrameCountIEd.setEnabled(true); startShowButton.setEnabled(!running && project.getFlames().size() > 0); stopShowButton.setEnabled(running); doRecordCBx.setEnabled(!running); motionTable.setEnabled(!running); addMotionCmb.setEnabled(!running); addMotionBtn.setEnabled(!running); Motion selMotion = getSelectedMotion(); deleteMotionBtn.setEnabled(!running && selMotion != null); renameMotionBtn.setEnabled(deleteMotionBtn.isEnabled()); boolean plainPropertySelected = flamePropertiesTreeService.isPlainPropertySelected(flamePropertiesTree); { boolean linkMotionEnabled = false; if (!running && selMotion != null && selMotion.getParent() == null) { if (plainPropertySelected) { FlamePropertyPath selPath = flamePropertiesTreeService.getSelectedPropertyPath(flamePropertiesTree); linkMotionEnabled = !selMotion.hasLink(selPath); } } linkMotionBtn.setEnabled(linkMotionEnabled); unlinkMotionBtn.setEnabled( selMotion != null && motionLinksTable.getSelectedRow() >= 0 && motionLinksTable.getSelectedRow() < selMotion.getMotionLinks().size()); } createMotionsCmb.setEnabled(!running); clearMotionsBtn.setEnabled(!running && project.getMotions().size() > 0); loadProjectBtn.setEnabled(!running); saveProjectBtn.setEnabled(!running); }
public void reactivate() { // Need to re-register incase the index node has been rebooted indexNode.registerChatListener(this); message.setEnabled(true); message.setText(""); message.requestFocus(); sendMessage.setEnabled(true); avatarTable.setEnabled(true); chatLog.setBackground(Color.white); // Set status active = true; }
private void selectProcess() { if (processing) { return; } selProcesses = list.getSelectedValuesList(); if (!selProcesses.isEmpty()) { processing = true; tableRes.setEnabled(false); resTableModel.getDataVector().removeAllElements(); resTableModel.fireTableDataChanged(); foundIs = null; progress.setIndeterminate(true); progress.setString(translate("searching")); progress.setStringPainted(true); progress.setVisible(true); final SelectProcessWorker wrk = new SelectProcessWorker(selProcesses); wrk.addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { switch (evt.getPropertyName()) { case "progress": progress.setIndeterminate(false); progress.setStringPainted(false); progress.setValue((Integer) evt.getNewValue()); break; case "state": if (((StateValue) evt.getNewValue()) == StateValue.DONE) { try { foundIs = wrk.get(); } catch (InterruptedException | ExecutionException ex) { Logger.getLogger(LoadFromMemoryFrame.class.getName()) .log(Level.SEVERE, null, ex); } if (foundIs == null) { addResultRow(null); } tableRes.setEnabled(foundIs != null); progress.setVisible(false); processing = false; } } } }); wrk.execute(); } }
private void fillTable(String command) { String content[][] = db.executeCommandArray(command); String title[] = new String[content[0].length]; JOptionPane.showMessageDialog( null, command + " returned\n " + content.length + " results", "Result", JOptionPane.WARNING_MESSAGE); // warung das nur 8 custom tabellen möglich sind for (int i = 0; i < title.length; i++) { title[i] = "C" + i; } table = new JTable(content, title); table.setEnabled(false); }
/** Diese Methode sortiert alle Highscores und fuegt sie in die Tabelle ein. */ public void sort() { Collections.sort(highscorelist); Vector<Object> tableContent = new Vector<Object>(); for (Highscore hsc : highscorelist) { if (highscorelist.indexOf(hsc) < 25) { Vector<Object> line = new Vector<Object>(); line.add(hsc.getName()); line.add(hsc.getPoints()); line.add(hsc.getNumOfRestCells()); long tempSystem = hsc.getSystemtime(); Date date = new Date(tempSystem); Format format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); line.add(format.format(date)); tableContent.add(line); lf.addHighscore(hsc, highscorelist.indexOf(hsc)); } } Vector<String> titel = new Vector<String>(); titel.add("Name"); titel.add("Punkte"); titel.add("Restzellen"); titel.add("Erreicht"); table1 = new JTable(tableContent, titel); table1.getColumn("Name").setPreferredWidth(200); table1.getColumn("Punkte").setPreferredWidth(100); table1.getColumn("Restzellen").setPreferredWidth(100); table1.getColumn("Erreicht").setPreferredWidth(200); table1.getTableHeader().setBackground(Color.lightGray); table1.setEnabled(false); DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(SwingConstants.RIGHT); for (int x = 0; x < table1.getColumnCount(); x++) { table1.getColumnModel().getColumn(x).setCellRenderer(centerRenderer); table1.getTableHeader().getColumnModel().getColumn(x).setCellRenderer(centerRenderer); } table1.setDefaultRenderer(String.class, centerRenderer); frame1.pack(); frame1.setLocationRelativeTo(null); table1.setVisible(true); frame1.getContentPane().add(new JScrollPane(table1)); }