statuswindow.java

来自「Java the UML Way 书中所有源码」· Java 代码 · 共 32 行

JAVA
32
字号
/*
 * StatusWindow.java   E.L. 2001-08-25
 *
 * This window is used at the client side for showing status information,
 * received from the server side. It's not possible to close the window. The user has to
 * exit the application by closing the CounterWindow, then he is disconnected
 * from the server, too. And this window is closed.
 */

import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.awt.*;

class StatusWindow extends JFrame implements Constants{
  private JLabel text = new JLabel("No message from the server yet.");
  public StatusWindow() {
    setTitle("Status");
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    Container guiContainer = getContentPane();
    text.setForeground(Color.black);
    guiContainer.add(new JLabel(), BorderLayout.NORTH);
    guiContainer.add(text, BorderLayout.CENTER);
    guiContainer.add(new JLabel(), BorderLayout.SOUTH);
    setLocation(locationStatusWindowX, locationStatusWindowY);
    setSize(widthStatusWindow, heightStatusWindow);
  }

  public void setStatus(String newStatus) {
    text.setText("   " + newStatus);
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?