⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 consoleframe.java

📁 Massively Multiplayer Space Trading and Combat game. This is an online strategy game, not a 3D space
💻 JAVA
字号:
/*
 * ConsoleFrame.java
 *
 * Copyright (C) 2000 Jason M. Hanley
 * Released under the GNU General Public License (GPL)
 * See license.txt for additional information.
 *
 * Created on July 28, 2000, 9:59 PM
 */
 
package fate.client;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;

import fate.messages.*;
import fate.network.*;
import fate.ui.*;
import fate.util.*;
import fate.world.*;

/** 
 * The main "console" that comes up after a client has successfully
 * connected to the game server.
 *
 * @author  preylude@s3m.com
 * @version 0.1.0
 */
public class ConsoleFrame extends JDialog implements ActionListener {

  MainFrame parent;

  public ClientConnection connection;
  public ChatPanel chatPanel;
  public MainViewPanel mainViewPanel;
  public Player player;

  /** Creates new ConsoleFrame */
  public ConsoleFrame( MainFrame parent, ClientConnection connection ) {
    super( parent, "Fate Console", true );
    this.parent = parent;
    this.connection = connection;
    player = null;

    JPanel bottomPanel = new FatePanel( new BorderLayout() );
    
    // Central UI
    mainViewPanel = new MainViewPanel( this );
    mainViewPanel.setOpaque( false );
    bottomPanel.add( mainViewPanel, BorderLayout.CENTER );
    
    // Right hand controls
    JPanel rightPanel = new JPanel();
    rightPanel.setOpaque( false );
    SwingUtil.addButton(  rightPanel, "Change Info", 'i', "ChangeInfo", this );
    bottomPanel.add( rightPanel, BorderLayout.EAST );
    
    // Chat messaging UI
    chatPanel = new ChatPanel( this );
    chatPanel.setOpaque( false );
    bottomPanel.add( chatPanel, BorderLayout.SOUTH );
    
    getContentPane().add( bottomPanel, BorderLayout.CENTER );
        
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        onExit();
      }
    } );
    
    // Initialization mostly complete.. we now need a Player object
    GetPlayerMessage getPlayerMessage = new GetPlayerMessage();
    connection.sendMessage( getPlayerMessage );
  }
  
  public void setPlayer( Player player ) {
    this.player = player;
  }

  /** Exit handler */
  public void onExit() {
    parent.onExit();
  }
  
  public void actionPerformed( ActionEvent e ) {
    String strAction = e.getActionCommand();
    
    Debug.trace( "client.MainFrame: ActionCommand: " + strAction );
    
    if ( strAction.equals( "ChangeInfo" ) ) {
      ChangeUserInfoDialog dialog = new ChangeUserInfoDialog( this );
      dialog.pack();
      SwingUtil.centerWindow( dialog );
      dialog.show();
    }
  }

}

⌨️ 快捷键说明

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