public void addMessage(String text) { if (text.indexOf('\n')>=0) theLabel = new MultiLineLabel(text); else theLabel = new Label(text); theLabel.setFont(font); c.gridx = 0; c.gridy = y; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; c.insets = getInsets(text.equals("")?0:10,10,0,0); grid.setConstraints(theLabel, c); add(theLabel); y++; }
/** Adds a message consisting of one or more lines of text, which will be displayed using the specified font and color. */ public void addMessage(String text, Font font, Color color) { theLabel = null; if (text.indexOf('\n')>=0) theLabel = new MultiLineLabel(text); else theLabel = new Label(text); if (addToSameRow) { c.gridx = GridBagConstraints.RELATIVE; addToSameRow = false; } else { c.gridx = 0; c.gridy++; c.insets = getInsets("".equals(text)?0:10, 20, 0, 0); // top, left, bottom, right } c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.HORIZONTAL; if (font!=null) { if (Prefs.getGuiScale()>1.0) font = font.deriveFont((float)(font.getSize()*Prefs.getGuiScale())); theLabel.setFont(font); } if (color!=null) theLabel.setForeground(color); add(theLabel, c); c.fill = GridBagConstraints.NONE; }
/** Adds a message consisting of one or more lines of text, which will be displayed using the specified font and color. */ public void addMessage(String text, Font font, Color color) { theLabel = null; if (text.indexOf('\n')>=0) theLabel = new MultiLineLabel(text); else theLabel = new Label(text); if (addToSameRow) { c.gridx = GridBagConstraints.RELATIVE; addToSameRow = false; } else { c.gridx = 0; c.gridy++; c.insets = getInsets("".equals(text)?0:10, 20, 0, 0); // top, left, bottom, right } c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.HORIZONTAL; if (font!=null) { if (Prefs.getGuiScale()>1.0) font = font.deriveFont((float)(font.getSize()*Prefs.getGuiScale())); theLabel.setFont(font); } if (color!=null) theLabel.setForeground(color); add(theLabel, c); c.fill = GridBagConstraints.NONE; }
if (text!=null && text.startsWith("IJ: ")) text = text.substring(4); label = new MultiLineLabel(text, 175); if (!IJ.isLinux()) label.setFont(new Font("SansSerif", Font.PLAIN, 14)); if (IJ.isMacOSX()) {
if (text!=null && text.startsWith("IJ: ")) text = text.substring(4); label = new MultiLineLabel(text, 175); if (!IJ.isLinux()) label.setFont(new Font("SansSerif", Font.PLAIN, 14)); if (IJ.isMacOSX()) {
public ChoicesDialog(Frame parent, String title, String msg, String[] options) { super(parent, title, true); setLayout(new BorderLayout()); Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); MultiLineLabel message = new MultiLineLabel(msg); message.setFont(new Font("Dialog", Font.BOLD, 12)); panel.add(message); add("North", panel); panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 15, 8)); buttons = new Button[options.length]; chosen = new boolean[options.length]; for (int i=0;i<options.length;++i) { buttons[i]=new Button(options[i]); buttons[i].addActionListener(this); panel.add(buttons[i]); } add("South", panel); if (ij.IJ.isMacintosh()) setResizable(false); pack(); GUI.center(this); setVisible(true); }
setFont(font); label = new MultiLineLabel(message); if (font!=null) label.setFont(font);
setFont(font); label = new MultiLineLabel(message); if (font!=null) label.setFont(font);
Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); MultiLineLabel message = new MultiLineLabel(msg); message.setFont(new Font("Dialog", Font.PLAIN, 12)); panel.add(message);
else { if (fileName.length()>22) message = new MultiLineLabel("Save changes to\n" + "\"" + fileName + "\"?"); else message = new Label("Save changes to \"" + fileName + "\"?");
else { if (fileName.length()>22) message = new MultiLineLabel("Save changes to\n" + "\"" + fileName + "\"?"); else message = new Label("Save changes to \"" + fileName + "\"?");
Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); MultiLineLabel message = new MultiLineLabel(msg); message.setFont(new Font("Dialog", Font.PLAIN, 14)); panel.add(message);
Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); MultiLineLabel message = new MultiLineLabel(msg); message.setFont(new Font("Dialog", Font.PLAIN, 14)); panel.add(message);