?? netwarpanel.java
字號(hào):
/*
Netwar
Copyright (C) 2002 Daniel Grund, Kyle Kakligian, Jason Komutrattananon, & Brian Hibler.
This file is part of Netwar.
Netwar is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Netwar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Netwar; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package netwar.gui;
import netwar.game.Command;
import netwar.Netwar;
import netwar.settings.PlayerSettings;
import netwar.game.UnitSet;
import java.awt.event.*;
import javax.swing.Timer;
/** This class creates the panel that is to be displayed with the Hex viewer during the main game.
* It consists of four tabs: Units, Base, Chat, and System.
* The Units tab displays information of how much health the currently selected unit has, and the units name, properties of the Unit, an image of the Unit, and what the Unit currently looks like on the Hex Viewer.
* The Base tab shows how much health the base has, the number of current units the base has, and the number of total units the base has. It allows you to construct units.
* The Chat tab allows you to send and view messages sent by other players.
* The System tab shows interesting "system statistics" such as graphic frames per second update frames per second.
*
*
* @author Brian Hibler <I>bshibs</I>
*/
public class NetwarPanel extends javax.swing.JPanel implements ActionListener, Chatable {
private Timer timer = new Timer(1500, this);
/** This will construct a new NetwarPanel.
*/
public NetwarPanel() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
java.awt.GridBagConstraints gridBagConstraints;
minimapViewer1 = new netwar.gui.MinimapViewer();
optionSelectPane = new javax.swing.JTabbedPane();
unitPanel = new javax.swing.JPanel();
unitViewLabel = new javax.swing.JLabel();
selectedUnitLabel = new javax.swing.JLabel();
unitSelectedNameLabel = new javax.swing.JLabel();
unitHealthTitleLabel = new javax.swing.JLabel();
unitHealthBar = new javax.swing.JProgressBar();
propertiesLabel = new javax.swing.JLabel();
currenthealthTitleLabel = new javax.swing.JLabel();
maxHealthTitleLabel = new javax.swing.JLabel();
currentHealthValueLabel1 = new javax.swing.JLabel();
maxHealthValueLabel1 = new javax.swing.JLabel();
property1TitleLabel = new javax.swing.JLabel();
property1ValueLabel = new javax.swing.JLabel();
property2TitleLabel = new javax.swing.JLabel();
property2ValueLabel = new javax.swing.JLabel();
property3TitleLabel = new javax.swing.JLabel();
property3ValueLabel = new javax.swing.JLabel();
property4TitleLabel = new javax.swing.JLabel();
property4ValueLabel = new javax.swing.JLabel();
property5TitleLabel = new javax.swing.JLabel();
property5ValueLabel = new javax.swing.JLabel();
property6TitleLabel = new javax.swing.JLabel();
property6ValueLabel = new javax.swing.JLabel();
justSpacingLabel1 = new javax.swing.JLabel();
justSpacingLabel2 = new javax.swing.JLabel();
justSpacingLabel3 = new javax.swing.JLabel();
unitViewHere = new javax.swing.JTextArea();
basePanel = new javax.swing.JPanel();
baseViewerTitleLabel = new javax.swing.JLabel();
baseHealthLabel = new javax.swing.JLabel();
baseHealthBar = new javax.swing.JProgressBar();
activeUnitsTitleLabel = new javax.swing.JLabel();
totalUnitsTitleLabel = new javax.swing.JLabel();
armyInfoTitleLabel = new javax.swing.JLabel();
totalBuiltUnitsValueField = new javax.swing.JTextField();
totalActiveUnitsValueField = new javax.swing.JTextField();
ButtonList = new javax.swing.JPanel();
chatPanel = new javax.swing.JPanel();
chatViewer1 = new netwar.gui.ChatViewer();
systemPanel = new javax.swing.JPanel();
gFramesPerSecTitleLabel = new javax.swing.JLabel();
uFramesPerSecTitleLabel = new javax.swing.JLabel();
systemStatisticsTitleLabel = new javax.swing.JLabel();
gFPerSecValueField = new javax.swing.JTextField();
uFPerSecValueField = new javax.swing.JTextField();
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
setBackground(java.awt.Color.black);
setForeground(new java.awt.Color(255, 255, 255));
add(minimapViewer1);
optionSelectPane.setBackground(java.awt.Color.gray);
unitPanel.setLayout(new java.awt.GridBagLayout());
unitPanel.setBackground(java.awt.Color.lightGray);
unitPanel.setForeground(new java.awt.Color(0, 0, 0));
unitViewLabel.setFont(new java.awt.Font("Dialog", 1, 18));
unitViewLabel.setForeground(java.awt.Color.white);
unitViewLabel.setText("Unit Viewer");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 5;
unitPanel.add(unitViewLabel, gridBagConstraints);
selectedUnitLabel.setFont(new java.awt.Font("Dialog", 1, 14));
selectedUnitLabel.setForeground(java.awt.Color.white);
selectedUnitLabel.setText("Name:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 2;
unitPanel.add(selectedUnitLabel, gridBagConstraints);
unitSelectedNameLabel.setFont(new java.awt.Font("Dialog", 1, 14));
unitSelectedNameLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 5;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
unitPanel.add(unitSelectedNameLabel, gridBagConstraints);
unitHealthTitleLabel.setFont(new java.awt.Font("Dialog", 1, 14));
unitHealthTitleLabel.setForeground(new java.awt.Color(255, 255, 255));
unitHealthTitleLabel.setText("Health:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 3;
unitPanel.add(unitHealthTitleLabel, gridBagConstraints);
unitHealthBar.setBackground(new java.awt.Color(255, 255, 255));
unitHealthBar.setFont(new java.awt.Font("Dialog", 0, 10));
unitHealthBar.setForeground(new java.awt.Color(255, 102, 98));
unitHealthBar.setString("Health");
unitHealthBar.setStringPainted(true);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 5;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
unitPanel.add(unitHealthBar, gridBagConstraints);
propertiesLabel.setFont(new java.awt.Font("Dialog", 3, 14));
propertiesLabel.setForeground(new java.awt.Color(255, 255, 255));
propertiesLabel.setText("Properties");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 8;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 7;
unitPanel.add(propertiesLabel, gridBagConstraints);
currenthealthTitleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
currenthealthTitleLabel.setForeground(new java.awt.Color(255, 255, 255));
currenthealthTitleLabel.setText("Current Health");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 10;
gridBagConstraints.gridy = 1;
unitPanel.add(currenthealthTitleLabel, gridBagConstraints);
maxHealthTitleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
maxHealthTitleLabel.setForeground(new java.awt.Color(255, 255, 255));
maxHealthTitleLabel.setText("Max Health");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 10;
gridBagConstraints.gridy = 2;
unitPanel.add(maxHealthTitleLabel, gridBagConstraints);
currentHealthValueLabel1.setFont(new java.awt.Font("Dialog", 0, 12));
currentHealthValueLabel1.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 12;
gridBagConstraints.gridy = 1;
unitPanel.add(currentHealthValueLabel1, gridBagConstraints);
maxHealthValueLabel1.setFont(new java.awt.Font("Dialog", 0, 12));
maxHealthValueLabel1.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 12;
gridBagConstraints.gridy = 2;
unitPanel.add(maxHealthValueLabel1, gridBagConstraints);
property1TitleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property1TitleLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 10;
gridBagConstraints.gridy = 3;
unitPanel.add(property1TitleLabel, gridBagConstraints);
property1ValueLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property1ValueLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 12;
gridBagConstraints.gridy = 3;
unitPanel.add(property1ValueLabel, gridBagConstraints);
property2TitleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property2TitleLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 10;
gridBagConstraints.gridy = 4;
unitPanel.add(property2TitleLabel, gridBagConstraints);
property2ValueLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property2ValueLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 12;
gridBagConstraints.gridy = 4;
unitPanel.add(property2ValueLabel, gridBagConstraints);
property3TitleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property3TitleLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 14;
gridBagConstraints.gridy = 1;
unitPanel.add(property3TitleLabel, gridBagConstraints);
property3ValueLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property3ValueLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 16;
gridBagConstraints.gridy = 1;
unitPanel.add(property3ValueLabel, gridBagConstraints);
property4TitleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property4TitleLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 14;
gridBagConstraints.gridy = 2;
unitPanel.add(property4TitleLabel, gridBagConstraints);
property4ValueLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property4ValueLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 16;
gridBagConstraints.gridy = 2;
unitPanel.add(property4ValueLabel, gridBagConstraints);
property5TitleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property5TitleLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 14;
gridBagConstraints.gridy = 3;
unitPanel.add(property5TitleLabel, gridBagConstraints);
property5ValueLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property5ValueLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 16;
gridBagConstraints.gridy = 3;
unitPanel.add(property5ValueLabel, gridBagConstraints);
property6TitleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property6TitleLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 14;
gridBagConstraints.gridy = 4;
unitPanel.add(property6TitleLabel, gridBagConstraints);
property6ValueLabel.setFont(new java.awt.Font("Dialog", 0, 12));
property6ValueLabel.setForeground(new java.awt.Color(255, 255, 255));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 16;
gridBagConstraints.gridy = 4;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -