void addCheckBoxes(String PortName) { for (int i = 0; i < 128; i++) { if (cb[i] != null) { p1.remove(cb[i]); } } for (int i = 1; i < 129; i++) { cb[i - 1] = new Checkbox(PortName + i); p1.add("NORTH", cb[i - 1]); } }
public void setEdge(Edge edge_in, Graph graph_in) { graph_ = graph_in; edge_ = edge_in; // if(edge_ == null) // edge_ = Edge.defaults; String title; // if(edge_ == Edge.defaults) // title = "Properties For Newly Created Edges"; // else title = "Edge " + edge_.tail().id_ + " " + edge_.head().id_; setTitle(title); style_.select(edge_.getLineStyle()); // if(edge_ != Edge.defaults) // { labelText_.setText(edge_.getLabel()); String points_string = new String(); DPoint3[] points = edge_.points(); for (int i = 0; i < points.length; i++) points_string += points[i].x + " " + points[i].y + " " + points[i].z + "\n"; pointsText_.setText(points_string); // Can't remove items from a Choice in Java 1.0. dataPanel_.remove(data_); data_ = new Choice(); dataPanel_.add(data_); dataHash_ = (Hashtable) edge_.data_.clone(); data_.addItem("<NEW>"); for (Enumeration keys = dataHash_.keys(); keys.hasMoreElements(); ) { String key = (String) keys.nextElement(); data_.addItem(key); } if (data_.countItems() == 1) // Need at least one item. data_.addItem("Data"); data_.select(1); currentData_ = data_.getItem(1); String value = (String) dataHash_.get(currentData_); if (value == null) value = new String(""); dataText_.setText(value); for (int i = 0; i < ndCount_; i++) notDefault_[i].show(); // } // else // for(int i = 0; i < ndCount_; i++) // notDefault_[i].hide(); pack(); }
public void removePanel(int pos) { NotebookPage np = (NotebookPage) pages.elementAt(pos); pages.removeElementAt(pos); oobj.remove(np.comp); showPanel(curIndex); }
/** * the method called by the DefaultCookiePolicyHandler. * * @return true if the cookie should be accepted */ public synchronized boolean accept(Cookie cookie, DefaultCookiePolicyHandler h, String server) { // set the new values name_value_label.setText(cookie.getName() + "=" + cookie.getValue()); domain_value.setText(cookie.getDomain()); path_value.setText(cookie.getPath()); if (cookie.expires() == null) expires_value.setText("never"); else expires_value.setText(cookie.expires().toString()); int pos = 2; if (cookie.isSecure()) add(secure_note, constr, pos++); if (cookie.discard()) add(discard_note, constr, pos++); if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; // set ports list if (cookie2.getPorts() != null) { ((GridLayout) left_panel.getLayout()).setRows(5); left_panel.add(ports_label, 2); ((GridLayout) right_panel.getLayout()).setRows(5); int[] ports = cookie2.getPorts(); StringBuffer plist = new StringBuffer(); plist.append(ports[0]); for (int idx = 1; idx < ports.length; idx++) { plist.append(", "); plist.append(ports[idx]); } ports_value.setText(plist.toString()); right_panel.add(ports_value, 2); } // set comment url if (cookie2.getCommentURL() != null) { c_url_note.setText("For more info on this cookie see: " + cookie2.getCommentURL()); add(c_url_note, constr, pos++); } // set comment if (cookie2.getComment() != null) { comment_value.setText(cookie2.getComment()); add(comment_label, constr, pos++); add(comment_value, constr, pos++); } } // invalidate all labels, so that new values are displayed correctly name_value_label.invalidate(); domain_value.invalidate(); ports_value.invalidate(); path_value.invalidate(); expires_value.invalidate(); left_panel.invalidate(); right_panel.invalidate(); secure_note.invalidate(); discard_note.invalidate(); c_url_note.invalidate(); comment_value.invalidate(); invalidate(); // set default domain test domain.setText(cookie.getDomain()); // display setResizable(true); pack(); setResizable(false); setLocation( (screen.width - getPreferredSize().width) / 2, (int) ((screen.height - getPreferredSize().height) / 2 * .7)); setVisible(true); default_focus.requestFocus(); // wait for user input try { wait(); } catch (InterruptedException e) { } setVisible(false); // reset popup remove(secure_note); remove(discard_note); left_panel.remove(ports_label); ((GridLayout) left_panel.getLayout()).setRows(4); right_panel.remove(ports_value); ((GridLayout) right_panel.getLayout()).setRows(4); remove(c_url_note); remove(comment_label); remove(comment_value); // handle accept/reject domain buttons if (accept_domain) { String dom = domain.getText().trim().toLowerCase(); if (accept) h.addAcceptDomain(dom); else h.addRejectDomain(dom); } return accept; }
public void setPanel(Panel panel) { if (panelContainer.getComponentCount() == 1) { panelContainer.remove(getComponent(0)); } panelContainer.add(panel); }