public void actionPerformed(ActionEvent event) { JMenuItem source = (JMenuItem) (event.getSource()); for (GraphView v : gp.getGraphViewList()) { if (v.getMenuText().equals(source.getText())) { v.view(); repaint(); return; } } for (GraphDrawer d : gp.getGraphDrawerList()) { if (d.getMenuText().equals(source.getText())) { d.layout(); repaint(); return; } } for (GraphUtility u : gp.getGraphUtilityList()) { if (u.getMenuText().equals(source.getText())) { u.apply(); repaint(); return; } } for (GraphExperiment ge : gp.getGraphExperimentList()) { if (ge.getMenuText().equals(source.getText())) { ge.experiment(); repaint(); return; } } }
public void testCreatesItemMenuWithItemsCorrectly() { _player.addItem(Item.BLOCKABALL); _player.addItem(Item.HEALVIAL); JMenu menu = _constructor.createItemMenu(); assertNameAndText(menu, "Items", "Items"); assertEquals("Number of menus was not correct", 3, menu.getItemCount()); assertAllItemsHaveNames(menu); JMenuItem blockaballItemMenu = getWithName(menu, "BLOCKABALL"); assertNotNull("Blockaball item menu was not added", blockaballItemMenu); assertEquals("Blockaball text was not right", "Blockaball", blockaballItemMenu.getText()); assertNotNull("Blockaball action was not set", blockaballItemMenu.getAction()); assertEquals(ItemAction.class, blockaballItemMenu.getAction().getClass()); JMenuItem healVialItemMenu = getWithName(menu, "HEALVIAL"); assertNotNull("HealVial item menu was not added", healVialItemMenu); assertEquals("HealVial text was not right", "Heal Vial", healVialItemMenu.getText()); assertNotNull("HealVial action was not set", healVialItemMenu.getAction()); assertEquals(ItemAction.class, healVialItemMenu.getAction().getClass()); JMenuItem backItemMenu = getWithName(menu, "Back"); assertNotNull("Back item menu was not added", backItemMenu); assertEquals("Back item text was not right", "Back", backItemMenu.getText()); assertNotNull("Back action was not set", backItemMenu.getAction()); assertEquals(BackAction.class, backItemMenu.getAction().getClass()); }
public void testCreatesTheItemShopMenu() { ItemShop building = new ItemShop(); building.stockItems(Item.BLOCKABALL, Item.HEALVIAL); JMenu menu = _constructor.createBuildingMenu(building, null); Assert.assertNotNull(menu); Assert.assertEquals(building.getName(), menu.getName()); Assert.assertEquals(building.getName(), menu.getText()); Assert.assertEquals(2, menu.getItemCount()); for (int i = 0; i < menu.getItemCount(); i++) { JMenuItem menuItem = menu.getItem(i); Action action = menuItem.getAction(); Assert.assertNotNull(action); Assert.assertEquals(ItemAction.class, action.getClass()); String name = menuItem.getName(); if (name.equals(Item.BLOCKABALL.toString())) { Assert.assertEquals(Item.BLOCKABALL.getWellFormattedString(), menuItem.getText()); } else if (name.equals(Item.HEALVIAL.toString())) { Assert.assertEquals(Item.HEALVIAL.getWellFormattedString(), menuItem.getText()); } else { Assert.fail("Name: " + name + " Text: " + menuItem.getText()); } } }
@Override public void actionPerformed(ActionEvent e) { JMenuItem item = (JMenuItem) e.getSource(); if (item.getText().equals(DEFAULT_THEME)) { mainPanel.setBackground(Color.BLUE); } else if (item.getText().equals(CUSTOM_THEME)) { mainPanel.setBackground(Color.RED); } }
public void testCreatesBlockamonMenuCorrectly() { Blockamon blockamon = new Blockamon(ElementType.BUG); _player.addToParty(blockamon); JMenu menu = _constructor.createBlockamonMenu(); assertNameAndText(menu, "Blockamon", "Blockamon"); assertEquals("Number of menu items was not correct", 2, menu.getItemCount()); JMenuItem blockamonMenuItem = menu.getItem(0); assertNameAndText( blockamonMenuItem, blockamon.elementType() + "0", blockamon.name() + ", " + blockamon.level() + ", " + blockamon.currentHp() + "/" + blockamon.maxHp()); assertNotNull("Blockamon menu action not set", blockamonMenuItem.getAction()); assertEquals(BlockamonAction.class, blockamonMenuItem.getAction().getClass()); JMenuItem backItemMenu = menu.getItem(1); assertNotNull("Back item menu was not added", backItemMenu); assertEquals("Back item text was not right", "Back", backItemMenu.getText()); assertNotNull("Back action was not set", backItemMenu.getAction()); assertEquals(BackAction.class, backItemMenu.getAction().getClass()); }
public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { JMenuItem item = (JMenuItem) e.getSource(); String name = item.getText(); profiles.delete(name); } }
/** actionPerformed */ @Override public void actionPerformed(ActionEvent e) { JMenuItem menuItem = (JMenuItem) e.getSource(); if (menuItem.getText().equals(recSwingApp.getTextoMenuItem(MENU_ITEM_SALIR))) acaba(); else if (menuItem.getText().equals(recSwingApp.getTextoMenuItem(MENU_ITEM_ACERCA_DE))) { JOptionPane.showMessageDialog( this, recSwingApp.getGeneral(RecursosAppSwing.TITULO) + "\n" + recSwingApp.getGeneral(RecursosAppSwing.AUTOR) + "\n" + recSwingApp.getGeneral(RecursosAppSwing.VERSION), recSwingApp.getTextoMenuItem(MENU_ITEM_ACERCA_DE), JOptionPane.INFORMATION_MESSAGE, recSwingApp.getIconoApp()); } }
public void actionPerformed(ActionEvent e) { String cmd = (e.getActionCommand()); if (cmd.equals(aboutItem.getText())) JOptionPane.showMessageDialog( this, "Simple Image Program for DB2004\nversion 0.1\nThanks to BvS", "About imageLab", JOptionPane.INFORMATION_MESSAGE); else if (cmd.equals(quitItem.getText())) System.exit(0); else if (cmd.equals(openItem.getText())) { int returnVal = chooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try { pic2 = new Picture(chooser.getSelectedFile().getName()); pic1 = new Picture(pic2.width(), pic2.height()); lab.setIcon(pic2.getJLabel().getIcon()); sliderPanel.setVisible(false); pack(); repaint(); } catch (Exception ex) { JOptionPane.showMessageDialog( this, "Could not open " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(), "Open Error", JOptionPane.INFORMATION_MESSAGE); } } } else if (cmd.equals(saveItem.getText())) { int returnVal = chooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try { pic2.save(chooser.getSelectedFile().getName()); } catch (Exception ex) { JOptionPane.showMessageDialog( this, "Could not write " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(), "Save Error", JOptionPane.INFORMATION_MESSAGE); } } } }
public void actionPerformed(ActionEvent event) { JMenuItem mi; String label = ""; if (warningPopup == null) { warningPopup = new WarningDialog(textViewerFrame); } if ((editor1 == null) || (editor1.getDocument() == null)) { String errstr = "TextViewer:editor1 or document is null"; warningPopup.display(errstr); return; } String actionStr = event.getActionCommand(); // is not makeing anysense // when keystrokes typed if ((event.getSource() instanceof JMenuItem)) { mi = (JMenuItem) event.getSource(); label = mi.getText(); } else if ((event.getSource() instanceof JTextArea)) { // keystroke label = "FindAgain"; // just set it to findagain } else { System.err.println("Debug:TextViewer:" + actionStr); System.err.println("Debug:TextViewer:" + event.getSource().toString()); String errstr = "TextViewer:FindAction: " + event.getSource().toString() + " not an instance of JMenuItem or JTextArea"; warningPopup.display(errstr); return; } if (label.equals("FindAgain")) { isFindAgain = true; lastFindStr = lastFindStr; } else { isFindAgain = false; lastFindStr = ""; } StringBoolean content = new StringBoolean(lastFindStr, forwardFindDirection); boolean okPressed = mySearchDialog.display(content); if (!okPressed) { return; } lastFindStr = content.mystring; forwardFindDirection = content.myboolean; if (forwardFindDirection) { lastFindIndex = searchForward(lastFindStr); // System.out.println("Debug:TextViewer: lastFindIndex:"+lastFindIndex); } else { lastFindIndex = searchBackward(lastFindStr); // System.out.println("Debug:TextViewer: lastFindIndex:"+lastFindIndex); } }
public void actionPerformed(ActionEvent e) { JMenuItem jmi = (JMenuItem) e.getSource(); Iterator marks = mediator.getMarkerModel().getMarkersWithLabel(jmi.getText()); if (marks.hasNext()) { ChronicleMarker marker = (ChronicleMarker) marks.next(); Instant to = marker.getWhen(); Instant from = mediator.getMajorMoment(); viper.api.impl.Util.shiftDescriptors(new Descriptor[] {desc}, from, to); } }
public void actionPerformed(ActionEvent e) { super.actionPerformed(e); JMenuItem jmi = (JMenuItem) e.getSource(); if (displayset.contains(jmi)) { mainPanel.setNames(jmi.getText()); } else if (jmi == hiddenItem) { mainPanel.showIgnored(hiddenItem.isSelected()); } else if (jmi == aggrItem) { mainPanel.showAggregates(aggrItem.isSelected()); } }
public void actionPerformed(ActionEvent e) { Iterator toInterp = Collections.singleton(desc).iterator(); JMenuItem jmi = (JMenuItem) e.getSource(); Iterator marks = mediator.getMarkerModel().getMarkersWithLabel(jmi.getText()); if (marks.hasNext()) { ChronicleMarker marker = (ChronicleMarker) marks.next(); Instant to = marker.getWhen(); Instant from = mediator.getMajorMoment(); mediator.getPropagator().interpolateDescriptors(toInterp, from, to); } }
/* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o instanceof JMenuItem) { JMenuItem sender = (JMenuItem) o; String name = sender.getText(); if (name.equals("close")) { tabbedPane.removeTabAt(tabbedPane.getSelectedIndex()); } else if (name.equals("save")) { int index = tabbedPane.getSelectedIndex(); Component c = tabbedPane.getComponent(index); Point p = c.getLocation(); Component t = tabbedPane.getComponentAt(new Point(p.x + 20, p.y + 30)); if (t instanceof TextView) { TextView text = (TextView) t; // String code = text.getText(); // save the code // saveTab(code); } if (t instanceof HTMLTextView) { HTMLTextView text = (HTMLTextView) t; fileChooser.setSelectedFile(new File(text.node.getName())); int returnVal = fileChooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File f = fileChooser.getSelectedFile(); // save the code String fileType = f.getName().substring(f.getName().lastIndexOf("."), f.getName().length()); if (fileType.indexOf("htm") != -1) { // save as html String code = text.getText(); saveTab(code, f); } else if (fileType.indexOf("java") != -1) { // save as java String code = text.getUnModyfiedContent(); saveTab(code, f); } else if (text.node.fileType.indexOf(FileTypes.MANIFEST) != -1 || text.node.fileType.indexOf(FileTypes.MANIFEST2) != -1) { String code = text.getUnModyfiedContent(); saveTab(code, f); System.out.println("Saved manifest"); } else { System.out.println("FILETYPE UNKNOWN:" + text.node.fileType); } } } } else if (name.equals("close all")) { tabbedPane.removeAll(); } } }
public static void addFastKeys(JMenuBar menuBar) { for (Component menuComponent : menuBar.getComponents()) { // iterate over menus JMenu menu = (JMenu) menuComponent; menu.setMnemonic(menu.getText().charAt(menu.getText().indexOf('&') + 1)); menu.setText(menu.getText().replace("&", "")); for (Component menuItemComponent : menu.getMenuComponents()) if (menuItemComponent instanceof JMenuItem) { // skip separators JMenuItem menuItem = (JMenuItem) menuItemComponent; menuItem.setMnemonic(menuItem.getText().charAt(menuItem.getText().indexOf('&') + 1)); menuItem.setText(menuItem.getText().replace("&", "")); } /* for (int count = 0; count < menu.getMenuComponentCount(); count++) { //iterate over menu items Component menuItemComponent = menu.getMenuComponent(count); if (menuItemComponent instanceof JMenuItem) { //skip separators JMenuItem menuItem = (JMenuItem)menuItemComponent; menuItem.setMnemonic(menuItem.getText().charAt( menuItem.getText().indexOf('&') + 1)); menuItem.setText(menuItem.getText().replace("&", "")); } } */ } }
public void actionPerformed(ActionEvent arg0) { Object src = arg0.getSource(); try { if (src instanceof JMenuItem) { JMenuItem item = (JMenuItem) src; String name = item.getText(); if (name.equals("Properties")) { renderDialog.init(); renderDialog.setVisible(true); } } } catch (Exception ex) { JOptionPane.showMessageDialog(this, ex.toString()); } }
public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { JMenuItem item = (JMenuItem) e.getSource(); String name = item.getText(); Profile profile = profiles.getProfile(name); Component[] components = selectorPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component comp = components[i]; if (comp instanceof CPCheckBox) { CPCheckBox scb = (CPCheckBox) comp; String id = scb.element.id; boolean enb = profile.has(id); scb.setState(enb); } } } }
public void testCreatesTheHealingCenterMenu() { Building building = new HealingCenter(); JMenu menu = _constructor.createBuildingMenu(building, null); Assert.assertNotNull(menu); Assert.assertEquals(building.getName(), menu.getName()); Assert.assertEquals(building.getName(), menu.getText()); Assert.assertEquals(1, menu.getItemCount()); for (int i = 0; i < menu.getItemCount(); i++) { JMenuItem menuItem = menu.getItem(i); Action action = menuItem.getAction(); Assert.assertNotNull(action); Assert.assertEquals(HealAction.class, action.getClass()); Assert.assertEquals("Heal", menuItem.getName()); Assert.assertEquals("Heal", menuItem.getText()); } }
public void actionPerformed(ActionEvent e) { JMenuItem source = (JMenuItem) (e.getSource()); String text = source.getText(); if (text.equals("Exit")) { System.exit(0); } else if (text.equals("Read Particle Location Data")) { File particleFile = null; if ((particleFile = getFileName(UintahGui.OPEN)) != null) { d_partList.readFromFile(particleFile); } } else if (text.equals("Save Uintah Input File")) { File uintahFile = null; if ((uintahFile = getFileName(UintahGui.SAVE)) != null) { writeUintah(uintahFile); } } else if (text.equals("About")) { helpAboutFrame.setVisible(true); } }
public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { JMenuItem item = (JMenuItem) e.getSource(); String name = item.getText(); if (name.equals("New...")) { name = JOptionPane.showInputDialog(selectorPanel, "Enter a name for the new profile."); } if ((name == null) || name.trim().equals("")) return; Profile profile = new Profile(name); Component[] components = selectorPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component comp = components[i]; if (comp instanceof CPCheckBox) { CPCheckBox scb = (CPCheckBox) comp; String id = scb.element.id; if (scb.isSelected()) profile.add(id); } } profiles.add(profile); } }
/** * set text to the specified item index * * @param index index */ public void setText(int index) { JMenuItem item = (JMenuItem) popup.getComponent(index); setText(item.getText()); } // setText()
private void assertNameAndText(JMenuItem menuItem, String name, String text) { Assert.assertEquals("Name of menu item is " + name, name, menuItem.getName()); Assert.assertEquals("Text of menu item is " + text, text, menuItem.getText()); }
/** * This method is not being used to paint menu item since 6.0 This code left for compatibility * only. Do not use or override it, this will not cause any visible effect. */ public static void paintMenuItem( Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { JMenuItem b = (JMenuItem) c; ButtonModel model = b.getModel(); Dimension size = b.getSize(); Insets i = c.getInsets(); Rectangle viewRect = new Rectangle(size); viewRect.x += i.left; viewRect.y += i.top; viewRect.width -= (i.right + viewRect.x); viewRect.height -= (i.bottom + viewRect.y); Rectangle iconRect = new Rectangle(); Rectangle textRect = new Rectangle(); Rectangle acceleratorRect = new Rectangle(); Rectangle checkRect = new Rectangle(); Rectangle arrowRect = new Rectangle(); Font holdf = g.getFont(); Font f = c.getFont(); g.setFont(f); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f); FontMetrics fmAccel = SwingUtilities2.getFontMetrics(c, g, UIManager.getFont("MenuItem.acceleratorFont")); if (c.isOpaque()) { if (model.isArmed() || (c instanceof JMenu && model.isSelected())) { g.setColor(background); } else { g.setColor(c.getBackground()); } g.fillRect(0, 0, size.width, size.height); } // get Accelerator text KeyStroke accelerator = b.getAccelerator(); String acceleratorText = ""; if (accelerator != null) { int modifiers = accelerator.getModifiers(); if (modifiers > 0) { acceleratorText = KeyEvent.getKeyModifiersText(modifiers); acceleratorText += "+"; } acceleratorText += KeyEvent.getKeyText(accelerator.getKeyCode()); } // layout the text and icon String text = layoutMenuItem( c, fm, b.getText(), fmAccel, acceleratorText, b.getIcon(), checkIcon, arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect, textRect, acceleratorRect, checkRect, arrowRect, b.getText() == null ? 0 : defaultTextIconGap, defaultTextIconGap); // Paint the Check Color holdc = g.getColor(); if (checkIcon != null) { if (model.isArmed() || (c instanceof JMenu && model.isSelected())) g.setColor(foreground); checkIcon.paintIcon(c, g, checkRect.x, checkRect.y); g.setColor(holdc); } // Paint the Icon if (b.getIcon() != null) { Icon icon; if (!model.isEnabled()) { icon = b.getDisabledIcon(); } else if (model.isPressed() && model.isArmed()) { icon = b.getPressedIcon(); if (icon == null) { // Use default icon icon = b.getIcon(); } } else { icon = b.getIcon(); } if (icon != null) { icon.paintIcon(c, g, iconRect.x, iconRect.y); } } // Draw the Text if (text != null && !text.equals("")) { // Once BasicHTML becomes public, use BasicHTML.propertyKey // instead of the hardcoded string below! View v = (View) c.getClientProperty("html"); if (v != null) { v.paint(g, textRect); } else { int mnemIndex = b.getDisplayedMnemonicIndex(); if (!model.isEnabled()) { // *** paint the text disabled g.setColor(b.getBackground().brighter()); SwingUtilities2.drawStringUnderlineCharAt( b, g, text, mnemIndex, textRect.x, textRect.y + fmAccel.getAscent()); g.setColor(b.getBackground().darker()); SwingUtilities2.drawStringUnderlineCharAt( b, g, text, mnemIndex, textRect.x - 1, textRect.y + fmAccel.getAscent() - 1); } else { // *** paint the text normally if (model.isArmed() || (c instanceof JMenu && model.isSelected())) { g.setColor(foreground); } else { g.setColor(b.getForeground()); } SwingUtilities2.drawStringUnderlineCharAt( b, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent()); } } } // Draw the Accelerator Text if (acceleratorText != null && !acceleratorText.equals("")) { // Get the maxAccWidth from the parent to calculate the offset. int accOffset = 0; Container parent = b.getParent(); if (parent != null && parent instanceof JComponent) { JComponent p = (JComponent) parent; Integer maxValueInt = (Integer) p.getClientProperty(MotifGraphicsUtils.MAX_ACC_WIDTH); int maxValue = maxValueInt != null ? maxValueInt.intValue() : acceleratorRect.width; // Calculate the offset, with which the accelerator texts will be drawn with. accOffset = maxValue - acceleratorRect.width; } g.setFont(UIManager.getFont("MenuItem.acceleratorFont")); if (!model.isEnabled()) { // *** paint the acceleratorText disabled g.setColor(b.getBackground().brighter()); SwingUtilities2.drawString( c, g, acceleratorText, acceleratorRect.x - accOffset, acceleratorRect.y + fm.getAscent()); g.setColor(b.getBackground().darker()); SwingUtilities2.drawString( c, g, acceleratorText, acceleratorRect.x - accOffset - 1, acceleratorRect.y + fm.getAscent() - 1); } else { // *** paint the acceleratorText normally if (model.isArmed() || (c instanceof JMenu && model.isSelected())) { g.setColor(foreground); } else { g.setColor(b.getForeground()); } SwingUtilities2.drawString( c, g, acceleratorText, acceleratorRect.x - accOffset, acceleratorRect.y + fmAccel.getAscent()); } } // Paint the Arrow if (arrowIcon != null) { if (model.isArmed() || (c instanceof JMenu && model.isSelected())) g.setColor(foreground); if (!(b.getParent() instanceof JMenuBar)) arrowIcon.paintIcon(c, g, arrowRect.x, arrowRect.y); } g.setColor(holdc); g.setFont(holdf); }
public void actionPerformed(ActionEvent e) { JMenuItem mi = (JMenuItem) e.getSource(); l.setText(mi.getText()); l.setIcon(mi.getIcon()); }
/* * Controls what happens when an action is detected (a menu item is * selected). */ public void actionPerformed(ActionEvent e) { /* The file to load from or save to. */ File file; /* Cast the source of the ActionEvent into a menu item for selection. */ JMenuItem source = (JMenuItem) (e.getSource()); /* Detect which menu item was clicked. */ if (source.getText().equals("Basic game")) { /* Upon selecting a new basic game, create a new basic game. */ this.currentgame.newGame("Basic", 5); } else if (source.getText().equals("Easy feeding game")) { /* * Upon selecting an easy feeding game, create a new easy feeding * game. */ this.currentgame.newGame("Feeding", 3); } else if (source.getText().equals("Moderate feeding game")) { /* * Upon selecting a moderate feeding game, create a new moderate * feeding game. */ this.currentgame.newGame("Feeding", 4); } else if (source.getText().equals("Hard feeding game")) { /* * Upon selecting a hard feeding game, create a new hard feeding * game. */ currentgame.newGame("Feeding", 10); } else if (source.getText().equals("Load...")) { /* Pause the game. */ this.currentgame.stopFeedingRow(); this.currentgame.pauseTimeLimit(); this.currentgame.stopTimeLimit(); /* * Present the user with a file chooser dialog to select the file * to load. */ file = getInputFile("Choose game to load"); if (file != null) { /* If the user chose a file, load it. */ this.currentgame.loadGame(file); } else { /* If a user cancelled loading resume play. */ this.currentgame.startFeedingRow(); this.currentgame.resumeTimeLimit(); this.currentgame.startTimeLimit(); } } else if (source.getText().equals("Save...")) { /* If the game is still going on... */ if (!this.currentgame.isGameOver()) { /* Pause the game. */ this.currentgame.stopFeedingRow(); this.currentgame.stopTimeLimit(); this.currentgame.pauseTimeLimit(); /* * Present the user with a file chooser dialog to choose where * they want to save to. */ file = getOutputFile("Choose where to save"); if (file != null) { /* If a file is selected, save to it. */ this.currentgame.saveGame(file); } /* Resume play. */ this.currentgame.startFeedingRow(); this.currentgame.resumeTimeLimit(); this.currentgame.startTimeLimit(); } else { /* * Emit a system beep to alert the user that the game cannot * be saved at this time. */ Toolkit.getDefaultToolkit().beep(); } } else if (source.getText().equals("Quit")) { /* Quit the game. */ System.exit(0); } }
public void actionPerformed(ActionEvent e) { JMenuItem selectedItem = (JMenuItem) e.getSource(); addNote(selectedItem.getText()); }
/** set default text */ public void setDefaultText() { JMenuItem item = (JMenuItem) popup.getComponent(0); if (item != null) setText(item.getText()); } // setDefaultText()