private void updateCompare(final boolean saveIndex) { if (isColumnCompare()) { // Column jText.setVisible(false); jCompareColumn.setVisible(true); jDate.setVisible(false); jSpacing.setVisible(true); } else if (isDateCompare()) { // Date jText.setVisible(false); jCompareColumn.setVisible(false); jDate.setVisible(true); jSpacing.setVisible(true); } else { // String jText.setVisible(true); jCompareColumn.setVisible(false); jDate.setVisible(false); jSpacing.setVisible(false); } Object object = jCompareColumn.getSelectedItem(); List<EnumTableColumn<E>> compareColumns; if (isNumericCompare()) { compareColumns = new ArrayList<EnumTableColumn<E>>(numericColumns); } else if (isDateCompare()) { compareColumns = new ArrayList<EnumTableColumn<E>>(dateColumns); } else { compareColumns = new ArrayList<EnumTableColumn<E>>(filterControl.getColumns()); } jCompareColumn.setModel(new ListComboBoxModel<EnumTableColumn<E>>(compareColumns)); for (Object column : compareColumns) { if (column.equals(object) && saveIndex) { jCompareColumn.setSelectedItem(column); } } }
// Mode modification public void modeModification() { resetCollection(); loadCollection(); resetCategorie(); loadCategorie(); comboCollection.setEnabled(true); textTitre.setVisible(true); textTitre.setEnabled(true); textTitre.setEditable(true); textAnnee.setVisible(true); textAnnee.setEnabled(true); textAnnee.setEditable(true); comboType.setVisible(true); comboType.setEnabled(true); comboEval.setVisible(true); comboEval.setEnabled(true); scrollCom.setEnabled(true); scrollCat.setEnabled(true); textCommentaires.setEnabled(true); textCommentaires.setEditable(true); textCommentaires.setBackground(Color.WHITE); textCommentaires.setText(""); textCategories.setEnabled(true); textCategories.setEditable(false); textCategories.setBackground(GRIS); textCategories.setText(""); for (int i = 0; i < infos_film.length; i++) { infos_film[i].setVisible(false); } for (int k = 0; k < modeButton.length; k++) { modeButton[k].setEnabled(false); modeButton[k].setVisible(false); } modeButton[3].setVisible(true); // Boutton Modifier modeButton[4].setVisible(true); // Boutton Supprimer boolean enabled = true; if (listeEstVide()) { enabled = false; } modeButton[3].setEnabled(enabled); modeButton[4].setEnabled(enabled); optionCategories[0].setEnabled(true); // Boutton ajouter categorie optionCategories[1].setEnabled(true); // Place the first element of combobox in the grid comboCollection.setSelectedIndex(0); Video video = this.obtenirVideo(comboCollection.getSelectedItem().toString()); afficherFilmChoisis(video.getTitre()); }
// Mode consultation public void modeConsultation() { resetCollection(); loadCollection(); comboCollection.setEnabled(true); textTitre.setVisible(false); textTitre.setEditable(false); textAnnee.setVisible(false); textAnnee.setEditable(false); comboType.setVisible(false); comboType.setEnabled(false); comboEval.setVisible(false); comboEval.setEnabled(false); // Juste au cas que ca foire scrollCom.setEnabled(true); scrollCat.setEnabled(true); textCommentaires.setEnabled(true); textCommentaires.setEditable(false); textCategories.setEnabled(true); textCategories.setEditable(false); textCommentaires.setBackground(GRIS); textCategories.setBackground(GRIS); for (int k = 0; k < infos_film.length; k++) { infos_film[k].setVisible(true); } // Place the first element of combobox in the grid DEPRECATED by Enoncé comboCollection.setSelectedIndex(comboCollection.getSelectedIndex()); for (int l = 0; l < modeButton.length; l++) { if (l < 2) { modeButton[0].setEnabled(false); modeButton[0].setVisible(true); if (comboCollection.getItemCount() > 1) { modeButton[l].setEnabled(true); modeButton[l].setVisible(true); } else { modeButton[l].setEnabled(false); modeButton[l].setVisible(true); } // modeButton[l].setEnabled(true); // modeButton[l].setVisible(true); } else { modeButton[l].setEnabled(false); modeButton[l].setVisible(false); } } optionCategories[0].setEnabled(false); optionCategories[1].setEnabled(false); // Get the collection and place in combobox Video video = this.obtenirVideo(comboCollection.getSelectedItem().toString()); afficherFilmChoisis(video.getTitre()); }
// Mode ajout public void modeAjout() { resetCollection(); loadCollection(); resetCategorie(); loadCategorie(); comboCollection.setEnabled(false); textTitre.setVisible(true); textTitre.setEnabled(true); textTitre.setEditable(true); textTitre.setText(""); textTitre.requestFocusInWindow(); textAnnee.setVisible(true); textAnnee.setEnabled(true); textAnnee.setEditable(true); textAnnee.setText(""); comboType.setVisible(true); comboType.setEnabled(true); comboType.setSelectedIndex(1); comboEval.setVisible(true); comboEval.setEnabled(true); comboEval.setSelectedIndex(0); // Juste au cas que ca foire scrollCom.setEnabled(true); scrollCat.setEnabled(true); textCommentaires.setEnabled(true); textCommentaires.setEditable(true); textCommentaires.setBackground(Color.WHITE); textCommentaires.setText(""); textCategories.setEnabled(true); textCategories.setEditable(false); textCategories.setBackground(GRIS); textCategories.setText(""); optionCategories[0].setEnabled(true); optionCategories[1].setEnabled(false); for (int i = 0; i < infos_film.length; i++) { infos_film[i].setVisible(false); } for (int k = 0; k < modeButton.length; k++) { if (k == 2) { modeButton[k].setEnabled(true); modeButton[k].setVisible(true); } else { modeButton[k].setEnabled(false); modeButton[k].setVisible(false); } } }
// Mode recherche public void modeRecherche() { resetCollection(); comboCollection.setEnabled(false); textTitre.setVisible(true); textTitre.setEnabled(true); textTitre.setEditable(true); textTitre.setText(""); textTitre.requestFocusInWindow(); textAnnee.setVisible(true); textAnnee.setEnabled(true); textAnnee.setEditable(true); textAnnee.setText(""); comboType.setVisible(true); comboType.setEnabled(true); comboType.setSelectedIndex(0); comboEval.setVisible(true); comboEval.setEnabled(false); // comboEval.setFont(); comboEval.setSelectedIndex(0); textCommentaires.setEnabled(true); textCommentaires.setEditable(false); textCommentaires.setBackground(GRIS); textCommentaires.setText(""); textCategories.setEnabled(true); textCategories.setEditable(false); textCategories.setBackground(GRIS); textCategories.setText(""); for (int i = 0; i < infos_film.length; i++) { infos_film[i].setVisible(false); } for (int k = 0; k < modeButton.length; k++) { modeButton[k].setEnabled(false); modeButton[k].setVisible(false); } modeButton[5].setVisible(true); // modeButton[6].setVisible(true); boolean enabled = true; if (listeEstVide()) { enabled = false; } optionCategories[0].setEnabled(enabled); optionCategories[1].setEnabled(enabled); modeButton[5].setEnabled(enabled); modeButton[6].setEnabled(true); }
public static void Initialize() { spConversation.setVisible(false); spUsersOnline.setVisible(false); messageField.setVisible(false); disconnect.setVisible(false); send.setVisible(false); userNameLabel.setVisible(true); userNameBox.setVisible(true); connectButton.setVisible(true); }
private void hideBootstrapOptions() { _bootstrap_rnd_seed_label.setVisible(false); _bootstrap_rnd_seed_textfield.setVisible(false); _bootstrap_rnd_seed_textfield.setText("1234"); _bootstrap_samples_label.setVisible(false); _bootstrap_samples_textfield.setVisible(false); _bootstrap_samples_textfield.setText("100"); _parameters.put(_use_bootstrap, null); _parameters.put(_random_seed, null); _parameters.put(_samples, null); }
private void startEdit(int index) { if (index < 0) { return; } LibraryPlaylistsListCell cell = (LibraryPlaylistsListCell) _model.getElementAt(index); _selectedIndexToRename = cell.getPlaylist() != null ? index : -1; String text = cell.getText(); Rectangle rect = _list.getUI().getCellBounds(_list, index, index); Dimension lsize = rect.getSize(); Point llocation = rect.getLocation(); _textName.setSize(lsize); _textName.setLocation(llocation); _textName.setText(text); _textName.setSelectionStart(0); _textName.setSelectionEnd(text.length()); _textName.setVisible(true); _textName.requestFocusInWindow(); _textName.requestFocus(); }
public void eventoClickCombo(String nroCuenta) { Long nroCuentaSeleccionada = 0L; for (Cuenta cuenta : Banco.recuperarMiBanco().getListaCajasDeAhorro().values()) { if (cuenta.toString().equals(nroCuenta)) { nroCuentaSeleccionada = cuenta.getNumeroCuenta(); } } if (nroCuentaSeleccionada == 0) { for (Cuenta cuenta : Banco.recuperarMiBanco().getListaCuentasCorriente().values()) { if (cuenta.toString().equals(nroCuenta)) { nroCuentaSeleccionada = cuenta.getNumeroCuenta(); } } } double saldo = Banco.recuperarMiBanco() .verCliente(dni) .getCuentasMonetarias() .get(nroCuentaSeleccionada) .getSaldoActual(); saldoResultado.setText(String.valueOf(saldo)); saldoResultado.setVisible(true); }
private void showPartitionedTypeOptions() { _het_models_partitioned.setVisible(true); _partitionfile_label.setVisible(true); _partitionfile_textfield.setVisible(true); _partitionfile_button.setVisible(true); _parameters.put(_alignmenttype, "par"); }
public static void connect() { final int port = 1337; final String host = "chat.linkura.se"; userName = userNameBox.getText().trim(); int count = 0; for (int i = 0; i < userName.length(); i++) { if (userName.charAt(i) == ' ') { count++; } } if (count != 0) { error.setText("Du får inte ha mellanslag i användarnamnet!"); } else if (userName.isEmpty()) { error.setText("Skriv ett användarnamn!"); } else if (!userName.matches("[a-öA-Ö0-9]+")) { error.setText("Användarnamnet får bara innhålla siffror och bokstäver!"); } else if (userName.length() > 15) { error.setText("Ditt användarnamn får max vara 15 tecken!"); } else { try { Socket socket = new Socket(host, port); testThread = new TestThread(socket); Thread x = new Thread(testThread); x.start(); PrintWriter out = new PrintWriter(socket.getOutputStream()); out.println("NICK " + userName); out.flush(); userNameLabel.setVisible(false); userNameBox.setVisible(false); connectButton.setVisible(false); messageField.setVisible(true); messageField.requestFocus(); send.setVisible(true); spConversation.setVisible(true); spUsersOnline.setVisible(true); disconnect.setVisible(true); } catch (IOException e) { e.printStackTrace(); } } }
private void checkSeek() { boolean seek = CHK_seek.isSelected(); SELECT_seekType.setVisible(seek); TEXT_seekPos.setVisible(seek); LABEL_seekPos.setVisible(seek); LABEL_seekType.setVisible(seek); LABEL_seek.setVisible(seek); }
/** * Update the dialog to display the attributes of a single object. The user may choose which * object to display by iterating forward and back through the set of objects. */ private void displayObjectProperties() { currentObject = destinationObjects[currentObjectIndex]; // Manage previous/next buttons. if (destinationObjects.length > 1) { currentObjectLabel.setText((currentObjectIndex + 1) + " of " + destinationObjects.length); previousObjectButton.setEnabled(currentObjectIndex > 0); nextObjectButton.setEnabled(currentObjectIndex < (destinationObjects.length - 1)); } // Unmodifiable fields. objectKeyTextField.setText(currentObject.getKey()); objectContentLengthTextField.setText(String.valueOf(currentObject.getContentLength())); objectLastModifiedTextField.setText(String.valueOf(currentObject.getLastModifiedDate())); objectETagTextField.setText(currentObject.getETag()); bucketLocationTextField.setText(currentObject.getBucketName()); if (currentObject.getOwner() != null) { ownerNameLabel.setVisible(true); ownerNameTextField.setVisible(true); ownerIdLabel.setVisible(true); ownerIdTextField.setVisible(true); ownerNameTextField.setText(currentObject.getOwner().getDisplayName()); ownerIdTextField.setText(currentObject.getOwner().getId()); } else { ownerNameLabel.setVisible(false); ownerNameTextField.setVisible(false); ownerIdLabel.setVisible(false); ownerIdTextField.setVisible(false); } // Clear old table contents while (objectMetadataTableModel.getRowCount() > 0) { objectMetadataTableModel.removeRow(0); } // Display remaining metadata items in the table. Iterator mdIter = currentObject.getModifiableMetadata().entrySet().iterator(); while (mdIter.hasNext()) { Map.Entry entry = (Map.Entry) mdIter.next(); Object name = entry.getKey(); Object value = entry.getValue(); objectMetadataTableModel.addRow(new Object[] {name, value}); } }
private void hidePartitionedTypeOptions() { _het_models_partitioned.setVisible(false); _het_models_partitioned_combobox.setSelectedIndex(0); _partitionfile_label.setVisible(false); _partitionfile_textfield.setVisible(false); _partitionfile_button.setVisible(false); _partitionfile_textfield.setText(""); _parameters.put(_partitionfile, null); }
// Updates the Buttons and what is visible and what isn't private void updateGui() { updateDisplay(); if (!itemSelected) { for (int i = 0; i < pockets.length; i++) { pockets[i].setVisible(true); pages[i].setVisible(true); } for (JButton aDisplay : display) { aDisplay.setVisible(true); } information.setVisible(true); closeButton.setVisible(true); moneyDisplay.setVisible(true); buySellButton.setVisible(true); buyButton.setVisible(false); amountField.setVisible(false); amountDisplay.setVisible(false); totalAmount.setVisible(false); buyButton.setVisible(false); sellButton.setVisible(false); moneyDisplay.setText("Money: $" + Inventory.money); updatePageButtons(); } else { if (state == State.BUY) { buyButton.setVisible(true); sellButton.setVisible(false); } else { buyButton.setVisible(false); sellButton.setVisible(true); } amountDisplay.setVisible(true); totalAmount.setVisible(true); buySellButton.setVisible(false); for (int i = 1; i < display.length; i++) { display[i].setVisible(false); } amountField.setVisible(true); for (int i = 0; i < pockets.length; i++) { pockets[i].setVisible(false); pages[i].setVisible(false); } moneyDisplay.setText("Money: $" + Inventory.money); } }
protected void textName_keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (_selectedIndexToRename != -1 && key == KeyEvent.VK_ENTER) { renameSelectedItem(_selectedIndexToRename); } else if (_selectedIndexToRename == -1 && key == KeyEvent.VK_ENTER) { createNewPlaylist(); } else if (key == KeyEvent.VK_ESCAPE) { _textName.setVisible(false); } }
/** Ré-intialise la fenêtre. */ private void re_init() { file_zotero = null; file_agents = null; endpoint = "http://ecoscopebc.mpl.ird.fr:8080/joseki/ecoscope"; fileOut_zotero.setText("Entrez le nom du fichier en sortie..."); fileOut_agents.setText("Entrez le nom du fichier en sortie..."); fileOut_clean.setText("Entrez le nom du fichier en sortie..."); fileOut_clean.setVisible(true); fileIn_zotero.setText("Fichier Zotero..."); fileIn_agents.setText("Fichier Agents..."); Desactiver_clean.setSelected(false); }
public void addString(String msg) { JTextField txtF = new JTextField(); txtF.setText(msg); txtF.setVisible(true); txtF.setBounds(new Rectangle(10, mYPos, X_WINDOW_SIZE * 5, Y_HEIGHT)); txtF.setBackground(mMainColor); txtF.setBorder(BorderFactory.createEmptyBorder()); txtF.setForeground(Color.WHITE); mJMain.add(txtF); mYPos += Y_STEP; }
public SoapServiceCallUiPanel(final VirtualizationUiOptions wireMockOption) { this.wireMockOptions = wireMockOption; wsdlUrl = new JTextField("", 50); username = new JTextField("", 5); password = new JTextField("df", 5); callSoapButton = new JButton("Call Soap Service"); requestTextArea = new JTextArea(5, 10); responseTextArea = new JTextArea(5, 10); pl = new JPanel(new FlowLayout()); // pl = new Panel(new BorderLayout()); JScrollPane requestTextAreaScrolPane = new JScrollPane( requestTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JScrollPane responseTextAreaScrolPane = new JScrollPane( responseTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JPanel pk = new JPanel(new FlowLayout()); authenitication = new JCheckBox("do we have autorization"); pk.add(wsdlUrl); pk.add(authenitication); pk.add(callSoapButton); Panel panel1 = new Panel(new FlowLayout()); panel1.add(requestTextAreaScrolPane); panel1.add(responseTextAreaScrolPane); pk.add(username); pk.add(password); username.setVisible(false); password.setVisible(false); authenitication.addActionListener(new AuthneticationMouseListener(username, password, pk)); callSoapButton.addActionListener( new CallSoapButtonListener( wsdlUrl, requestTextArea, responseTextArea, username, password, wireMockOptions)); pl.add(panel1); pl.add(pk, BorderLayout.PAGE_START); }
private void renameSelectedItem(int index) { if (!_textName.isVisible() || _textName.getText().trim().length() == 0) { return; } Playlist selectedPlaylist = getSelectedPlaylist(); selectedPlaylist.setName(_textName.getText().trim()); selectedPlaylist.save(); _list.repaint(); _textName.setVisible(false); }
private void checkVisibilityOfSmtpAuth() { boolean val = cb_smtp_auth.isSelected(); lb_smtpUser.setVisible(val); tf_smtpUser.setVisible(val); lb_smtpPW.setVisible(val); pf_smtpPW.setVisible(val); cb_pwSave.setVisible(val); if (!val) { tf_smtpUser.setText(""); pf_smtpPW.setText(""); cb_pwSave.setSelected(false); } repaint(); }
private void myInit() { tf_branch.grabFocus(); init_key(); hover(); search(); init(); tf_branch_id.enable(false); tf_branch_id.setVisible(false); focus(); String where = ""; branches_list.clear(); branches_list = Branches.ret_where(where); init_tbl_branch_locations(); }
/* * (non-Javadoc) * * @see maptool.client.Tool#attachTo(maptool.client.ZoneRenderer) */ @Override protected void attachTo(ZoneRenderer renderer) { oldShowGrid = AppState.isShowGrid(); AppState.setShowGrid(true); Grid grid = renderer.getZone().getGrid(); boolean showSecond = grid.getCapabilities().isSecondDimensionAdjustmentSupported() ? true : false; gridSecondDimension.setVisible(showSecond); gridSecondDimensionLabel.setVisible(showSecond); MapTool.getFrame().showControlPanel(controlPanel); renderer.repaint(); super.attachTo(renderer); copyGridToControlPanel(); }
private void createNewPlaylist() { if (!_textName.isVisible()) { return; } String name = _textName.getText(); Library library = LibraryMediator.getLibrary(); Playlist playlist = library.newPlaylist(name, name); playlist.save(); LibraryPlaylistsListCell cell = new LibraryPlaylistsListCell( null, null, GUIMediator.getThemeImage("playlist"), playlist, _selectedPlaylistAction); _model.addElement(cell); _list.setSelectedValue(cell, true); _textName.setVisible(false); }
@Override protected void doComboBoxAction() { if (comboBox.getSelectedIndex() > 0) { // get params of the selected resource type paramNames = new ArrayList<String>(); paramValues = new ArrayList<JTextField>(); AbstractConstraint selectedCons = ((ComboBoxConstraint) comboBox.getSelectedItem()).getConstraint(); for (final Method m : selectedCons.getClass().getDeclaredMethods()) { if (m.isAnnotationPresent(ExchangeParameter.class) && m.getName().startsWith("set")) { // For every setter method get the name of the parameter to // set and display it as a label along with a text field for // setting the value. String name = m.getName().substring(3).toLowerCase(); paramNames.add(name); JLabel paramName = new JLabel(name.replaceFirst("demanded", "demanded ")); paramName.setVisible(true); paramsPanel.add(paramName); JTextField paramValue = new JTextField(3); try { paramValue.setText( selectedCons .getClass() .getMethod("get" + m.getName().substring(3), new Class<?>[0]) .invoke(selectedCons, new Object[0]) .toString()); } catch (Exception e) { e.printStackTrace(); throw new AssertionError( "Error occurred while trying to access a get Metdod of the Object " + entity); } paramValue.setEditable(true); paramValue.setVisible(true); paramValues.add(paramValue); paramsPanel.add(paramValue); paramValue.requestFocus(); } } } }
/** Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Field with information about online clients field_clients_online = new JTextField("No clients online"); field_clients_online.setBounds(10, 10, 200, 20); field_clients_online.setHorizontalAlignment(0); field_clients_online.setEditable(false); field_clients_online.setVisible(true); frame.add(field_clients_online); combo_clients_online = new JComboBox<String>(); combo_clients_online.setBounds(10, 40, 200, 30); combo_clients_online.setVisible(true); frame.add(combo_clients_online); area_messages = new JTextArea(); area_messages.setBounds(10, 80, 400, 100); area_messages.setVisible(true); frame.add(area_messages); combo_clients_online.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String client = combo_clients_online.getSelectedItem().toString(); System.out.println(client); } }); this.db_query = new Query(); updateStatus(); }
public static JTextField addField( Function method, String text, int length, String tooltip, boolean enabled, boolean visible, final IClientPluginAccess pluginAccess) { JTextField field = new JTextField(text); field.setEnabled(enabled); field.setVisible(visible); field.setToolTipText(tooltip); if (length == 0) { field.setColumns(8); } field.setColumns(length); final FunctionDefinition functionDef = new FunctionDefinition(method); field.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JTextField source = (JTextField) e.getSource(); Object args[] = new Object[4]; args[0] = ((Toolbar) source.getParent()).getName(); args[1] = ((Toolbar) source.getParent()).getDisplayName(); args[2] = new Boolean(false); args[3] = source.getText(); functionDef.executeAsync(pluginAccess, args); } }); return field; }
public RepositoryLocationChooser( Dialog owner, RepositoryLocation resolveRelativeTo, String initialValue, final boolean allowEntries, final boolean allowFolders, boolean enforceValidRepositoryEntryName, final boolean onlyWriteableRepositories) { if (initialValue != null) { try { RepositoryLocation repositoryLocation; if (resolveRelativeTo != null) { repositoryLocation = new RepositoryLocation(resolveRelativeTo, initialValue); } else { repositoryLocation = new RepositoryLocation(initialValue); } locationField.setText(repositoryLocation.getName()); locationFieldRepositoryEntry.setText(repositoryLocation.getName()); resultLabel.setText(repositoryLocation.toString()); } catch (Exception e) { } } this.resolveRelativeTo = resolveRelativeTo; this.enforceValidRepositoryEntryName = enforceValidRepositoryEntryName; tree = new RepositoryTree(owner, !allowEntries, onlyWriteableRepositories); if (initialValue != null) { if (tree.expandIfExists(resolveRelativeTo, initialValue)) { locationField.setText(""); locationFieldRepositoryEntry.setText(""); } } tree.getSelectionModel() .addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { if (e.getPath() != null) { currentEntry = (Entry) e.getPath().getLastPathComponent(); if (currentEntry instanceof Folder) { // && allowFolders)) { // locationField.setText(""); } else if ((!(currentEntry instanceof Folder)) && allowEntries) { // if (true) { // //!(currentEntry instanceof Folder)) { locationField.setText(currentEntry.getLocation().getName()); locationFieldRepositoryEntry.setText(currentEntry.getLocation().getName()); } updateResult(); } } }); KeyListener keyListener = new KeyListener() { @Override public void keyPressed(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) { updateResult(); } @Override public void keyTyped(KeyEvent e) { TreePath selectionPath = tree.getSelectionPath(); if (selectionPath != null) { Entry selectedEntry = (Entry) selectionPath.getLastPathComponent(); if (!(selectedEntry instanceof Folder)) { tree.setSelectionPath(selectionPath.getParentPath()); } } } }; locationField.addKeyListener(keyListener); locationFieldRepositoryEntry.addKeyListener(keyListener); locationFieldRepositoryEntry.addObserver(this, true); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(0, 0, 0, 0); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.anchor = GridBagConstraints.FIRST_LINE_START; c.gridwidth = GridBagConstraints.REMAINDER; JScrollPane treePane = new ExtendedJScrollPane(tree); treePane.setBorder(ButtonDialog.createBorder()); add(treePane, c); c.insets = new Insets(ButtonDialog.GAP, 0, 0, ButtonDialog.GAP); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.weighty = 0; c.gridwidth = GridBagConstraints.RELATIVE; c.weightx = 0; locationLabel = new ResourceLabel("repository_chooser.entry_name"); locationLabel.setLabelFor(locationField); add(locationLabel, c); c.weightx = 1; c.insets = new Insets(ButtonDialog.GAP, 0, 0, 0); c.weightx = 1; c.gridwidth = GridBagConstraints.REMAINDER; add(locationField, c); add(locationFieldRepositoryEntry, c); if (enforceValidRepositoryEntryName) { locationField.setVisible(false); } else { locationFieldRepositoryEntry.setVisible(false); } c.gridwidth = GridBagConstraints.RELATIVE; c.weightx = 0; c.insets = new Insets(ButtonDialog.GAP, 0, 0, ButtonDialog.GAP); add(new ResourceLabel("repository_chooser.location"), c); c.weightx = 1; c.insets = new Insets(ButtonDialog.GAP, 0, 0, 0); c.gridwidth = GridBagConstraints.REMAINDER; add(resultLabel, c); if (resolveRelativeTo != null) { resolveBox = new JCheckBox( new ResourceActionAdapter( "repository_chooser.resolve", resolveRelativeTo.getAbsoluteLocation())); resolveBox.setSelected( ParameterService.getParameterValue( RapidMinerGUI.PROPERTY_RESOLVE_RELATIVE_REPOSITORY_LOCATIONS) .equals("true")); add(resolveBox, c); resolveBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateResult(); } }); } }
public void intitialize() { Client.setVisible(false); Server.setVisible(false); GridBagConstraints spc = new GridBagConstraints(); spc.gridx = 0; spc.gridy = 1; // spc.gridwidth = 2; spc.fill = GridBagConstraints.HORIZONTAL; spc.weightx = 1.0; cp.setLayout(new GridBagLayout()); cp.add(SinglePlayer, spc); SinglePlayer.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { System.out.println("Singleplayer"); Startmenu.IntroStopped = true; Startmenu.playsound = true; MultiPlayer.setVisible(false); SinglePlayer.setVisible(false); LevelEditor.setVisible(false); SpielStarten.setVisible(true); } }); GridBagConstraints mpc = new GridBagConstraints(); mpc.gridx = 1; mpc.gridy = 1; // mpc.gridwidth = 2; mpc.fill = GridBagConstraints.HORIZONTAL; mpc.weightx = 1.0; // cp.setLayout(new GridBagLayout()); cp.add(MultiPlayer, mpc); MultiPlayer.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { System.out.println("Multi"); Startmenu.IntroStopped = true; Startmenu.playsound = true; MultiPlayer.setVisible(false); SinglePlayer.setVisible(false); LevelEditor.setVisible(false); Client.setVisible(true); Server.setVisible(true); IPFeld.setVisible(true); IPLabel.setVisible(true); PortFeld.setVisible(true); PortLabel.setVisible(true); } }); GridBagConstraints le = new GridBagConstraints(); le.gridx = 0; le.gridy = 2; le.gridwidth = 2; le.fill = GridBagConstraints.HORIZONTAL; le.weightx = 1.0; // cp.setLayout(new GridBagLayout()); cp.add(LevelEditor, le); LevelEditor.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { System.out.println("Levelmachen"); Startmenu.IntroStopped = true; Startmenu.playsound = true; // startpanel.setVisible(false); final GLevelEditor KLaus = new GLevelEditor(); javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run() { KLaus.intitialize(); } }); } }); this.startpanel = new JPanel() { private static final long serialVersionUID = 1L; public void paintComponent(Graphics g) { if (!Startmenu.IntroStopped) g.drawImage( GlobalGraphics.intro, 0, 0, Startmenu.panelSizeX, Startmenu.panelSizeY - 50, this); else { g.drawImage( GlobalGraphics.intro2, 0, 0, Startmenu.panelSizeX, Startmenu.panelSizeY - 50, this); if (Startmenu.playsound == true) new Sound("src/sounds/DelayExp1.wav", 7000).start(); Startmenu.playsound = false; } } }; IPFeld = new JTextField("localhost"); GridBagConstraints ipf = new GridBagConstraints(); ipf.gridx = 1; ipf.gridy = 1; spc.gridwidth = 1; ipf.fill = GridBagConstraints.HORIZONTAL; cp.add(IPFeld, ipf); IPFeld.setVisible(false); PortFeld = new JTextField("4000"); GridBagConstraints pf = new GridBagConstraints(); pf.gridx = 1; pf.gridy = 2; spc.gridwidth = 1; pf.fill = GridBagConstraints.HORIZONTAL; cp.add(PortFeld, pf); PortFeld.setVisible(false); GridBagConstraints pa = new GridBagConstraints(); pa.gridx = 0; pa.gridy = 0; pa.gridwidth = 2; pa.fill = GridBagConstraints.BOTH; pa.weightx = 1.0; pa.weighty = 1.0; // cp.setLayout(new GridBagLayout()); cp.add(startpanel, pa); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); this.setSize(Startmenu.panelSizeX, Startmenu.panelSizeY); this.setVisible(true); GridBagConstraints server = new GridBagConstraints(); server.gridx = 0; server.gridy = 3; server.gridwidth = 1; server.fill = GridBagConstraints.HORIZONTAL; server.weightx = 1.0; // cp.setLayout(new GridBagLayout()); cp.add(Server, server); Server.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Port = PortFeld.getText(); try { Runtime.getRuntime() .exec(new String[] {"java", "-jar", "Server.jar", "4000"}); // ,"parameter"}); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // ,parameter}); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { Runtime.getRuntime() .exec( new String[] { "java", "-jar", "Client.jar", "localhost", "4000" }); // ,"parameter"}); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // ,parameter}); } }); GridBagConstraints sps = new GridBagConstraints(); sps.gridx = 0; sps.gridy = 2; sps.gridwidth = 2; sps.gridheight = 2; sps.fill = GridBagConstraints.HORIZONTAL; sps.weightx = 2.0; // cp.setLayout(new GridBagLayout()); cp.add(SpielStarten, sps); SpielStarten.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String SinglePlayerPort = "4000"; try { Runtime.getRuntime() .exec( new String[] { "java", "-jar", "Server.jar", SinglePlayerPort, "single" }); // ,"parameter"}); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // ,parameter}); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { Runtime.getRuntime() .exec( new String[] { "java", "-jar", "Client.jar", "localhost", SinglePlayerPort }); // ,"parameter"}); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // ,parameter}); } // try { // Runtime.getRuntime().exec( // new String[] { "java", "-jar", "Server.jar", SinglePlayerPort, "single"});// // ,"parameter"}); // } catch (IOException e1) { // // TODO Auto-generated catch block // e1.printStackTrace(); // }// ,parameter}); // try { // Thread.sleep(100); // } catch (InterruptedException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // try { // Runtime.getRuntime().exec( // new String[] { "java", "-jar", "Client.jar","localhost", SinglePlayerPort });// // ,"parameter"}); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // }// ,parameter}); // // } }); SpielStarten.setVisible(false); GridBagConstraints client = new GridBagConstraints(); client.gridx = 1; client.gridy = 3; client.gridwidth = 1; client.fill = GridBagConstraints.HORIZONTAL; client.weightx = 1.0; // cp.setLayout(new GridBagLayout()); cp.add(Client, client); Client.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { IP = IPFeld.getText(); Port = PortFeld.getText(); try { Runtime.getRuntime() .exec(new String[] {"java", "-jar", "Client.jar", IP, Port}); // ,"parameter"}); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // ,parameter}); } }); IPLabel = new JLabel(" Server IP : "); GridBagConstraints il = new GridBagConstraints(); il.gridx = 0; il.gridy = 1; // spc.gridwidth = 2; il.fill = GridBagConstraints.HORIZONTAL; // spinner.weightx = 1.0; cp.add(IPLabel, il); IPLabel.setVisible(false); PortLabel = new JLabel(" Port : "); GridBagConstraints pl = new GridBagConstraints(); pl.gridx = 0; pl.gridy = 2; // spc.gridwidth = 2; pl.fill = GridBagConstraints.HORIZONTAL; // spinner.weightx = 1.0; cp.add(PortLabel, pl); PortLabel.setVisible(false); }
public void createControlPanel() { pnTitle.setLayout(new FlowLayout()); pnTitle.setBorder(BorderFactory.createEtchedBorder()); lblTitle.setFont(new Font("Arial", Font.BOLD, 25)); pnTitle.add(lblTitle); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); pnCenter.setBorder(BorderFactory.createEtchedBorder()); pnCenter.setLayout(gridbag); c.gridx = 0; c.gridy = 1; c.gridheight = 1; c.insets = new Insets(5, 3, 3, 3); c.anchor = GridBagConstraints.SOUTHWEST; pnCenter.add(lblCourierId, c); c.gridx = 1; c.gridy = 1; c.gridheight = 1; c.insets = new Insets(5, 3, 0, 3); c.anchor = GridBagConstraints.SOUTHWEST; txtCourierId.setEditable(false); txtCourierId.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtCourierId, c); c.gridx = 0; c.gridy = 2; pnCenter.add(lblCourierName, c); c.gridx = 1; c.gridy = 2; txtCourierName.setEditable(false); txtCourierName.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtCourierName, c); c.gridx = 0; c.gridy = 3; pnCenter.add(lblCustomerName, c); c.gridx = 1; c.gridy = 3; txtCustomerName.setEditable(false); txtCustomerName.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtCustomerName, c); c.gridx = 0; c.gridy = 4; pnCenter.add(lblPhone, c); c.gridx = 1; c.gridy = 4; txtPhone.setEditable(false); txtPhone.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtPhone, c); c.gridx = 0; c.gridy = 5; pnCenter.add(lblWeight, c); c.gridx = 1; c.gridy = 5; txtWeight.setEditable(false); txtWeight.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtWeight, c); c.gridx = 0; c.gridy = 6; pnCenter.add(lblDepartLocation, c); c.gridx = 1; c.gridy = 6; txtDepartLocation.setEditable(false); txtDepartLocation.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtDepartLocation, c); c.gridx = 0; c.gridy = 7; pnCenter.add(lblDestination, c); c.gridx = 1; c.gridy = 7; txtDestination.setEditable(false); txtDestination.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtDestination, c); c.gridx = 0; c.gridy = 8; pnCenter.add(lblDistance, c); c.gridx = 1; c.gridy = 8; txtDistance.setEditable(false); txtDistance.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtDistance, c); c.gridx = 0; c.gridy = 9; pnCenter.add(lblSender, c); c.gridx = 1; c.gridy = 9; txtSenderShow.setEditable(false); txtSenderShow.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtSenderShow, c); c.gridx = 0; c.gridy = 10; pnCenter.add(lblReceiver, c); c.gridx = 1; c.gridy = 10; txtReceiverShow.setEditable(false); txtReceiverShow.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtReceiverShow, c); c.gridx = 1; c.gridy = 11; txtSender.setVisible(false); txtSender.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtSender, c); c.gridx = 1; c.gridy = 12; txtReceiver.setVisible(false); txtReceiver.setPreferredSize(new Dimension(300, 30)); pnCenter.add(txtReceiver, c); pnButton.setLayout(new FlowLayout()); pnButton.setBorder(BorderFactory.createEtchedBorder()); pnButton.add(btnConfirm); pnMain.setLayout(new BorderLayout()); pnMain.setBackground(Color.LIGHT_GRAY); pnMain.setBorder(BorderFactory.createRaisedSoftBevelBorder()); pnMain.add(pnTitle, BorderLayout.NORTH); pnMain.add(pnCenter, BorderLayout.CENTER); pnMain.add(pnButton, BorderLayout.SOUTH); getContentPane().add(pnMain, BorderLayout.CENTER); }