List of usage examples for java.awt TextField TextField
public TextField(String text, int columns) throws HeadlessException
From source file:WebCrawler.java
public void init() { // set up the main UI panel panelMain = new Panel(); panelMain.setLayout(new BorderLayout(5, 5)); // text entry components Panel panelEntry = new Panel(); panelEntry.setLayout(new BorderLayout(5, 5)); Panel panelURL = new Panel(); panelURL.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); Label labelURL = new Label("Starting URL: ", Label.RIGHT); panelURL.add(labelURL);//from w w w . j a v a 2 s . c om textURL = new TextField("", 40); panelURL.add(textURL); panelEntry.add("North", panelURL); Panel panelType = new Panel(); panelType.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); Label labelType = new Label("Content type: ", Label.RIGHT); panelType.add(labelType); choiceType = new Choice(); choiceType.addItem("text/html"); choiceType.addItem("audio/basic"); choiceType.addItem("audio/au"); choiceType.addItem("audio/aiff"); choiceType.addItem("audio/wav"); choiceType.addItem("video/mpeg"); choiceType.addItem("video/x-avi"); panelType.add(choiceType); panelEntry.add("South", panelType); panelMain.add("North", panelEntry); // list of result URLs Panel panelListButtons = new Panel(); panelListButtons.setLayout(new BorderLayout(5, 5)); Panel panelList = new Panel(); panelList.setLayout(new BorderLayout(5, 5)); Label labelResults = new Label("Search results"); panelList.add("North", labelResults); Panel panelListCurrent = new Panel(); panelListCurrent.setLayout(new BorderLayout(5, 5)); listMatches = new List(10); panelListCurrent.add("North", listMatches); labelStatus = new Label(""); panelListCurrent.add("South", labelStatus); panelList.add("South", panelListCurrent); panelListButtons.add("North", panelList); // control buttons Panel panelButtons = new Panel(); Button buttonSearch = new Button(SEARCH); buttonSearch.addActionListener(this); panelButtons.add(buttonSearch); Button buttonStop = new Button(STOP); buttonStop.addActionListener(this); panelButtons.add(buttonStop); panelListButtons.add("South", panelButtons); panelMain.add("South", panelListButtons); add(panelMain); setVisible(true); repaint(); // initialize search data structures vectorToSearch = new Vector(); vectorSearched = new Vector(); vectorMatches = new Vector(); // set default for URL access URLConnection.setDefaultAllowUserInteraction(false); }
From source file:width.java
public void init() { GridBagLayout gridBag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); setLayout(gridBag);//from ww w . ja v a 2s. c om Label receiverLabel = new Label("Receiver name:", Label.RIGHT); gridBag.setConstraints(receiverLabel, c); add(receiverLabel); nameField = new TextField(getParameter("RECEIVERNAME"), 10); c.fill = GridBagConstraints.HORIZONTAL; gridBag.setConstraints(nameField, c); add(nameField); nameField.addActionListener(this); Button button = new Button("Send message"); c.gridwidth = GridBagConstraints.REMAINDER; //end row c.anchor = GridBagConstraints.WEST; //stick to the //text field c.fill = GridBagConstraints.NONE; //keep the button //small gridBag.setConstraints(button, c); add(button); button.addActionListener(this); status = new TextArea(5, 60); status.setEditable(false); c.anchor = GridBagConstraints.CENTER; //reset to the default c.fill = GridBagConstraints.BOTH; //make this big c.weightx = 1.0; c.weighty = 1.0; gridBag.setConstraints(status, c); add(status); myName = getParameter("NAME"); Label senderLabel = new Label("(My name is " + myName + ".)", Label.CENTER); c.weightx = 0.0; c.weighty = 0.0; gridBag.setConstraints(senderLabel, c); add(senderLabel); newline = System.getProperty("line.separator"); }
From source file:Align_Projections.java
public void run(String arg) { if (instance != null) { instance.toFront();/*from w ww .ja v a 2s .co m*/ return; } instance = this; addKeyListener(IJ.getInstance()); if (sourceStackImp == null) { sourceStackImp = WindowManager.getCurrentImage(); if (sourceStackImp != null) { centerPixel = 0.5 * (sourceStackImp.getWidth() - 1); } else { centerPixel = 50; // completely arbitrary } } setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); Panel valuesPanel = new Panel(); valuesPanel.setLayout(new GridLayout(6, 2)); Label centerPixelLabel = new Label("Center Pixel"); valuesPanel.add(centerPixelLabel); centerPixelText = new TextField(IJ.d2s(centerPixel, 1), 15); valuesPanel.add(centerPixelText); Label detectorAngleLabel = new Label("Detector Angle"); valuesPanel.add(detectorAngleLabel); detectorAngleText = new TextField(IJ.d2s(0, 4), 15); valuesPanel.add(detectorAngleText); Label horizontalBorderLabel = new Label("Horizontal Border"); valuesPanel.add(horizontalBorderLabel); horizontalBorderText = new TextField("0", 15); valuesPanel.add(horizontalBorderText); Label topBorderLabel = new Label("Top Border"); valuesPanel.add(topBorderLabel); topBorderText = new TextField("0", 15); valuesPanel.add(topBorderText); Label bottomBorderLabel = new Label("Bottom Border"); valuesPanel.add(bottomBorderLabel); bottomBorderText = new TextField("0", 15); valuesPanel.add(bottomBorderText); Label crossCorrelationLabel = new Label("Cross-Correlation"); valuesPanel.add(crossCorrelationLabel); crossCorrelationText = new Label("-"); valuesPanel.add(crossCorrelationText); this.add(valuesPanel); updateButton = addButton("Update"); optimizeButton = addButton("Optimize"); applyButton = addButton("Apply to stack and save"); resetButton = addButton("Reset"); pack(); GUI.center(this); show(); }