javax.swing.JFrame.getTitle()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(201)

本文整理了Java中javax.swing.JFrame.getTitle()方法的一些代码示例,展示了JFrame.getTitle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getTitle()方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getTitle

JFrame.getTitle介绍

暂无

代码示例

代码示例来源:origin: RipMeApp/ripme

trayMenuMain = new MenuItem("Hide");
trayMenuMain.addActionListener(arg0 -> toggleTrayClick());
MenuItem trayMenuAbout = new MenuItem("About " + mainFrame.getTitle());
trayMenuAbout.addActionListener(arg0 -> {
  StringBuilder about = new StringBuilder();
  about.append("<html><h1>")
     .append(mainFrame.getTitle())
     .append("</h1>");
  about.append("Download albums from various websites:");
  int response = JOptionPane.showConfirmDialog(null,
      about.toString(),
      mainFrame.getTitle(),
      JOptionPane.YES_NO_OPTION,
      JOptionPane.PLAIN_MESSAGE,
  mainIcon = ImageIO.read(getClass().getClassLoader().getResource("icon.png"));
  trayIcon = new TrayIcon(mainIcon);
  trayIcon.setToolTip(mainFrame.getTitle());
  trayIcon.setImageAutoSize(true);
  trayIcon.setPopupMenu(trayMenu);

代码示例来源:origin: RipMeApp/ripme

mainFrame.toFront();
mainFrame.setAlwaysOnTop(true);
trayIcon.displayMessage(mainFrame.getTitle(), "Started ripping " + ripper.getURL().toExternalForm(), MessageType.INFO);
mainFrame.setAlwaysOnTop(false);

代码示例来源:origin: biojava/biojava

/**
 * Return the title of the AlignmentJmol window.
 */
public String getTitle(){
  return frame.getTitle();
}

代码示例来源:origin: com.google.code.validationframework/validationframework-swing

/**
 * @see AbstractComponentProperty#getPropertyValueFromComponent()
 */
@Override
protected String getPropertyValueFromComponent() {
  return component.getTitle();
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public void windowClosing(WindowEvent e) {
  m_FramedOutput.remove(jf.getTitle());
  jf.dispose();
 }
});

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame("Hello swing");
JPanel panel = new JPanel();
int len = frame.getTitle().length();
Dimension dimension = new Dimension(200 + 7*len, 200);
panel.setPreferredSize(dimension);

代码示例来源:origin: robotframework/SwingLibrary

private boolean titleMatches(Component component) {
  if (component instanceof JFrame) {
    String title = ((JFrame) component).getTitle();
    return ObjectUtils.nullSafeEquals(title, expectedNameOrTitle);
  }
  return false;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
 * Gets the Title attribute of the SkinWindowWindow object
 * 
 * @return The Title value
 */
public String getTitle() {
 String title = "";
 if (frame != null)
  title = frame.getTitle();
 else if (dialog != null) title = dialog.getTitle();
 return title;
}

代码示例来源:origin: cpesch/RouteConverter

public void run() {
    log.severe(format("Error while operating on RouteConverter service: %s, %s", t, printStackTrace(t)));
    showMessageDialog(frame,
        MessageFormat.format(RouteConverter.getBundle().getString("route-service-error"), t.getClass(), getLocalizedMessage(t)),
        frame.getTitle(), JOptionPane.WARNING_MESSAGE);
  }
});

代码示例来源:origin: cpesch/RouteConverter

public void handleOpenError(final Throwable throwable, final List<URL> urls) {
  invokeLater(() -> {
    String dialogUrls = printArrayToDialogString(urls.toArray(), true);
    log.severe("Open error from " + dialogUrls + ": " + throwable + "\n" + printStackTrace(throwable));
    showMessageDialog(frame, new JLabel(MessageFormat.format(getBundle().getString("open-error"), dialogUrls, getLocalizedMessage(throwable))),
        frame.getTitle(), ERROR_MESSAGE);
  });
}

代码示例来源:origin: cpesch/RouteConverter

public void showMapException(String mapName, Exception e) {
    log.severe("Cannot display map " + mapName + ": " + getLocalizedMessage(e));
    showMessageDialog(getFrame(), format(getBundle().getString("cannot-display-map"), mapName, e),
        getFrame().getTitle(), ERROR_MESSAGE);
  }
}

代码示例来源:origin: cpesch/RouteConverter

private static boolean checkForFeature(String featureName, String featureDescription) {
  if (!hasFeature(featureName)) {
    final RouteConverter r = RouteConverter.getInstance();
    showMessageDialog(r.getFrame(), new JLabel(MessageFormat.format(RouteConverter.getBundle().getString("feature-not-available"), featureDescription)),
        r.getFrame().getTitle(), ERROR_MESSAGE);
    return false;
  }
  return true;
}

代码示例来源:origin: cpesch/RouteConverter

public void handleRoutingException(Throwable t) {
  if (t instanceof OutOfMemoryError)
    handleOutOfMemoryError((OutOfMemoryError) t);
  else {
    log.severe("Cannot route position list: " + getLocalizedMessage(t));
    showMessageDialog(getFrame(), format(getBundle().getString("cannot-route-position-list"), t),
        getFrame().getTitle(), ERROR_MESSAGE);
  }
}

代码示例来源:origin: igniterealtime/Spark

@Override
public void flashWindow(Window window) {
  if (pref.isSystemTrayNotificationEnabled()) {
    trayIcon.setImage(newMessageIcon.getImage());
    if (window instanceof JFrame) {
      ((JFrame) window).setTitle(getCounteredTitle(
          ((JFrame) window).getTitle(), chatMessageHandler.getUnreadMessages()));
    }
    newMessage = true;
  }
}

代码示例来源:origin: cpesch/RouteConverter

public void run() {
    try {
      doInsertWithRoutingService(routingService, selectedRows);
    } catch (Exception e) {
      log.severe("Cannot insert positions: " + getLocalizedMessage(e));
      showMessageDialog(getFrame(), format(Application.getInstance().getContext().getBundle().getString("cannot-insert-positions"), e),
          getFrame().getTitle(), ERROR_MESSAGE);                }
  }
});

代码示例来源:origin: cpesch/RouteConverter

public static void handleThrowable(Class clazz, Throwable throwable) {
    log.severe(format("Unhandled throwable in action %s: %s, %s", clazz.getSimpleName(), throwable, printStackTrace(throwable)));
    showMessageDialog(getFrame(),
        MessageFormat.format(Application.getInstance().getContext().getBundle().
            getString("unhandled-throwable-error"), clazz.getSimpleName(), getLocalizedMessage(throwable), printStackTrace(throwable)),
        getFrame().getTitle(), ERROR_MESSAGE);
  }
}

代码示例来源:origin: cpesch/RouteConverter

private boolean confirmOverwrite(String file) {
  int confirm = showConfirmDialog(RouteConverter.getInstance().getFrame(),
      MessageFormat.format(RouteConverter.getBundle().getString("save-confirm-overwrite"), file),
      RouteConverter.getInstance().getFrame().getTitle(), YES_NO_OPTION);
  return confirm != YES_OPTION;
}

代码示例来源:origin: cpesch/RouteConverter

public void run() {
    showMessageDialog(getFrame(),
        MessageFormat.format(Application.getInstance().getContext().getBundle().
            getString("out-of-memory-error"), limitBefore, limitAfter),
        getFrame().getTitle(), ERROR_MESSAGE);
  }
});

代码示例来源:origin: otros-systems/otroslogviewer

protected boolean isMatching(JFrame frame1) {
  return frame1.getTitle().startsWith("OtrosLogViewer") && frame1.isShowing();
 }
}).using(robot);

代码示例来源:origin: triplea-game/triplea

@Test
void title() {
 final JFrame frame = JFrameBuilder.builder()
   .title(TITLE)
   .build();
 assertThat(
   frame.getTitle(),
   is(TITLE));
}

相关文章

JFrame类方法