protected void wrapStringOnPanel(String message, Container container) { GridBagConstraints c = getDefaultConstraints(); c.gridwidth = GridBagConstraints.REMAINDER; // Insets() args are top, left, bottom, right c.insets = new Insets(0, 0, 0, 0); GridBagLayout gbLayout = (GridBagLayout) container.getLayout(); while (message.length() > 0) { int newLineIndex = message.indexOf('\n'); String line; if (newLineIndex >= 0) { line = message.substring(0, newLineIndex); message = message.substring(newLineIndex + 1); } else { line = message; message = ""; } Label label = new Label(line); label.setFont(DISPLAY_FONT); gbLayout.setConstraints(label, c); container.add(label); } }
constraintsLabel.gridy = 0; Label label = new Label("H2 Console URL:", Label.LEFT); label.setFont(font); mainPanel.add(label, constraintsLabel);
leave_button.setFont(default_font); leave_button.addActionListener(this); mbr_label=new Label("0 mbr(s)"); mbr_label.setFont(default_font); sub_panel.add("South", clear_button);
leave_button.setFont(default_font); leave_button.addActionListener(this); mbr_label = new Label("1 mbr(s)"); mbr_label.setFont(default_font); p.add("South", leave_button);
protected void wrapStringOnPanel(String message, Container container) { GridBagConstraints c = getDefaultConstraints(); c.gridwidth = GridBagConstraints.REMAINDER; // Insets() args are top, left, bottom, right c.insets = new Insets(0, 0, 0, 0); GridBagLayout gbLayout = (GridBagLayout) container.getLayout(); while (message.length() > 0) { int newLineIndex = message.indexOf('\n'); String line; if (newLineIndex >= 0) { line = message.substring(0, newLineIndex); message = message.substring(newLineIndex + 1); } else { line = message; message = ""; } Label label = new Label(line); label.setFont(DISPLAY_FONT); gbLayout.setConstraints(label, c); container.add(label); } }
/** * Initialize the "threads" section GUI elements. * Elements should be added for the remainder of the width of the <code>container</code>. * * @param container The container where the elements are to be added. * @param constraints The constraints with which the elements are to be added to the <code>container</code>. */ protected void initThreads(Container container, GridBagConstraints constraints) { constraints.gridwidth = GridBagConstraints.REMAINDER; container.add(new Label(), constraints); }
/** Add a right justified line of text to the message. */ public void addRight(String lb) { v.addElement(new Label(lb,Label.RIGHT)); } /** This action will dispose of this graphics object and
private Label makeLabel(String label) { if (IJ.isMacintosh()) label += " "; return new Label(label); }
/** * Add a field editor. * @param title The title for the field. * @param editor Its editor component. */ protected void addField (String title, Component editor) { Label label = new Label(title, Label.LEFT) ; gb.setConstraints(label, ct) ; add(label) ; gb.setConstraints(editor, cv) ; add(editor) ; }
private Label addLabel(String txt) { constr.insets = new Insets(10, 5, 0, 5); Label label = new Label(txt); label.setFont(font); add(label, constr); constr.insets = new Insets(0, 5, 0, 5); return label; }
/** * Helper method to add the header of the PointList as a Label to the panel. */ private void addHeader() { final Label l = new Label(header); l.setFont(new Font("Verdana", Font.BOLD, 12)); c.gridy = 0; c.gridwidth = 2; c.gridx = 0; add(l, c); c.gridwidth = 1; }
private Label addLabel(String s, GridBagConstraints c) { Label label = new Label(s); label.setFont(font); this.add(label, c); return label; } }
private Panel createSourceStatus() { sourceStatusBar = new Panel(new BorderLayout()); sourceStatusLabel = new Label("Bob", Label.CENTER); sourceStatusBar.add(sourceStatusLabel, BorderLayout.CENTER); sourceStatusBar.setVisible(false); return sourceStatusBar; }
@Override protected void initThreads(Container container, GridBagConstraints constraints) { this.threadsLabel = new Label("Threads:"); container.add(this.threadsLabel, constraints); this.threadsField = new TextField(ApfloatContext.getContext().getProperty(ApfloatContext.NUMBER_OF_PROCESSORS), 5); constraints.gridwidth = GridBagConstraints.REMAINDER; container.add(this.threadsField, constraints); }
private void addHints() { // larger font to distinguish keys more easily Font keyFont = new Font("Monospaced", Font.PLAIN, 12); addLabel("Hints:"); Label label = new Label("Jump to prev/next selection:"); label.setFont(font); add(label, constr); label = new Label("\",\"\t/\t\".\""); label.setFont(keyFont); add(label, constr); }
public InstanceSavePanel() { setLayout(new BorderLayout()); arffFile_Tex = new TextField("arffoutput.arff"); add("Center", arffFile_Tex); count_Lab = new Label("0 instances"); add("East", count_Lab); // setSize(60,40); setBackground(Color.lightGray); }
private void init() { setLayout( new BorderLayout()); label = new Label(getString(true)); checkbox = new Checkbox(); checkbox.setState(true); checkbox.addItemListener(this); add(checkbox,"West"); add(label,"Center"); size = new Dimension(75,30); }