Skip to content

Commit 14ae977

Browse files
committed
增加关于界面
1 parent 80ce8de commit 14ae977

File tree

9 files changed

+85
-4
lines changed

9 files changed

+85
-4
lines changed

conf/nbs-conf.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ nbs.server.integrated.enabled=true
2121
nbs.server.ip.checked-url=http://www.net.cn/static/customercare/yourip.asp
2222
nbs.server.ip.checked-locations-url=http://ip.taobao.com/service/getIpInfo.php?ip=
2323

24+
# NBS site
25+
nbs.site.home.url=http://nbsio.net

conf/nbs.db

0 Bytes
Binary file not shown.

src/main/java/io/nbs/client/cnsts/ColorCnst.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class ColorCnst {
2525
public static Color FONT_WHITE = new Color(255, 255, 255);
2626
public static Color FONT_GRAY = new Color(152, 152, 152);
2727
public static Color FONT_GRAY_DARKER = new Color(152, 152, 152);
28+
public static Color FONT_URL_BLUE = new Color(51,153,255);
2829
public static Color DARKER = new Color(38, 41, 46);
2930
public static Color ITEM_SELECTED_DARK = new Color(57, 63, 68);
3031
public static Color ITEM_SELECTED = new Color(65, 71, 78);

src/main/java/io/nbs/client/ui/frames/MainFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class MainFrame extends JFrame {
5757
public static int RIGHT_EIDTH = 540;
5858
private static boolean heartMonitor = true;
5959

60-
public static final int TOOLBAR_WIDTH = 80;
60+
public static final int TOOLBAR_WIDTH = 80;
6161

6262
/**
6363
* 右侧窗口

src/main/java/io/nbs/client/ui/panels/TitlePanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private void initComponents(){
6666
restoreIcon = new ImageIcon(getClass().getResource("/icons/window_restore.png"));
6767
titlePanel = new JPanel();
6868
titlePanel.setLayout(new GridBagLayout());
69-
//titlePanel.setBackground(ColorCnst.WINDOW_BACKGROUND);
69+
titlePanel.setBackground(ColorCnst.WINDOW_BACKGROUND);
7070

7171
titleLabel = new JLabel();
7272
titleLabel.setFont(FontUtil.getDefaultFont(15));

src/main/java/io/nbs/client/ui/panels/about/AboutBodyPanel.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package io.nbs.client.ui.panels.about;
22

33
import io.nbs.client.ui.panels.ParentAvailablePanel;
4+
import io.nbs.commons.utils.IconUtil;
45

56
import javax.swing.*;
67

8+
79
/**
810
* @Package : io.nbs.client.ui.panels.about
911
* @Description : <p></p>
@@ -15,11 +17,15 @@
1517
public class AboutBodyPanel extends ParentAvailablePanel {
1618
private static AboutBodyPanel context;
1719

20+
private JLabel backgroundLabel;
21+
1822
/**
1923
* construction
2024
*/
2125
public AboutBodyPanel(JPanel parent) {
2226
super(parent);
27+
context =this;
28+
2329
initComponents();
2430
initView();
2531
setListeners();
@@ -32,6 +38,11 @@ public AboutBodyPanel(JPanel parent) {
3238
*/
3339
private void initComponents() {
3440

41+
ImageIcon icon = IconUtil.getIcon(context,"/icons/about_bg.png");
42+
backgroundLabel = new JLabel();
43+
backgroundLabel.setIcon(icon);
44+
45+
3546
}
3647

3748
/**
@@ -40,7 +51,7 @@ private void initComponents() {
4051
* @return {[type]} [description]
4152
*/
4253
private void initView() {
43-
54+
this.add(backgroundLabel);
4455
}
4556

4657
private void setListeners() {
@@ -55,4 +66,17 @@ private void setListeners() {
5566
public static AboutBodyPanel getContext() {
5667
return context;
5768
}
69+
/*
70+
@Override
71+
protected void paintComponent(Graphics g) {
72+
73+
g.drawImage(bgImage,this.getWidth(),this.getHeight(),null);
74+
Graphics2D g2 = (Graphics2D)g;
75+
*//* int width = getWidth();
76+
int height = getHeight();
77+
GradientPaint gradientPaint = new GradientPaint(0,0,new Color(37,32,72),width,height,new Color(59,54,98));
78+
g2.setPaint(gradientPaint);
79+
g2.fillRect(0,0,width,height);*//*
80+
}*/
81+
5882
}

src/main/java/io/nbs/client/ui/panels/about/AboutFooterPanel.java

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
package io.nbs.client.ui.panels.about;
22

3+
import io.nbs.client.cnsts.ColorCnst;
4+
import io.nbs.client.cnsts.FontUtil;
5+
import io.nbs.client.ui.frames.MainFrame;
36
import io.nbs.client.ui.panels.ParentAvailablePanel;
7+
import io.nbs.commons.helper.ConfigurationHelper;
48

59
import javax.swing.*;
10+
import java.awt.*;
11+
import java.awt.event.MouseAdapter;
12+
import java.awt.event.MouseEvent;
13+
import java.io.IOException;
614

715
/**
816
* @Package : io.nbs.client.ui.panels.about
@@ -14,12 +22,18 @@
1422
*/
1523
public class AboutFooterPanel extends ParentAvailablePanel {
1624
private static AboutFooterPanel context;
25+
private final String sitUrl;
26+
27+
private final String SITE_HOME = "nbsio.net";
28+
29+
private JLabel siteLabel;
1730

1831
/**
1932
* construction
2033
*/
2134
public AboutFooterPanel(JPanel parent) {
2235
super(parent);
36+
sitUrl = ConfigurationHelper.getInstance().getCfgProps().getProperty("nbs.site.home.url","http://nbsio.net/");
2337
initComponents();
2438
initView();
2539
setListeners();
@@ -31,6 +45,12 @@ public AboutFooterPanel(JPanel parent) {
3145
* @return {[type]} [description]
3246
*/
3347
private void initComponents() {
48+
siteLabel = new JLabel(SITE_HOME);
49+
siteLabel.setToolTipText(sitUrl);
50+
siteLabel.setForeground(ColorCnst.FONT_ABOUT_TITLE_BLUE);
51+
siteLabel.setFont(FontUtil.getDefaultFont(18));
52+
//siteLabel.setOpaque(true);
53+
siteLabel.setBackground(ColorCnst.WINDOW_BACKGROUND_LIGHT);
3454

3555
}
3656

@@ -40,11 +60,38 @@ private void initComponents() {
4060
* @return {[type]} [description]
4161
*/
4262
private void initView() {
43-
63+
this.setLayout(new FlowLayout(FlowLayout.RIGHT,30,5));
64+
this.add(siteLabel);
4465
}
4566

4667
private void setListeners() {
68+
siteLabel.addMouseListener(new MouseAdapter() {
69+
@Override
70+
public void mouseClicked(MouseEvent e) {
71+
super.mouseClicked(e);
72+
java.net.URI uri = java.net.URI.create(sitUrl);
73+
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
74+
if(desktop.isSupported(Desktop.Action.BROWSE)){
75+
try {
76+
desktop.browse(uri);
77+
} catch (IOException e1) {
78+
}
79+
}
80+
}
81+
82+
@Override
83+
public void mouseEntered(MouseEvent e) {
84+
super.mouseEntered(e);
85+
e.getComponent().setForeground(ColorCnst.FONT_URL_BLUE);
86+
e.getComponent().setCursor(MainFrame.handCursor);
87+
}
4788

89+
@Override
90+
public void mouseExited(MouseEvent e) {
91+
super.mouseExited(e);
92+
e.getComponent().setForeground(ColorCnst.FONT_ABOUT_TITLE_BLUE);
93+
}
94+
});
4895
}
4996

5097
/**

src/main/java/io/nbs/client/ui/panels/about/AboutMasterPanel.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.nbs.client.ui.panels.about;
22

33
import io.nbs.client.cnsts.ColorCnst;
4+
import io.nbs.client.ui.components.SizeAutoAdjustTextArea;
45
import io.nbs.client.ui.frames.MainFrame;
56
import io.nbs.client.ui.panels.TitlePanel;
67

@@ -27,6 +28,7 @@ public class AboutMasterPanel extends JPanel {
2728
private AboutFooterPanel footerPanel;
2829
protected static Properties cfgProps;
2930

31+
3032
public AboutMasterPanel() {
3133
this.cfgProps = ConfigurationHelper.getInstance().getCfgProps();
3234
initComponents();
@@ -45,6 +47,9 @@ private void initComponents(){
4547

4648
// headerPanel.setOpaque(false);
4749
headerPanel.setBackground(ColorCnst.WINDOW_BACKGROUND_LIGHT);
50+
bodyPanel.setBackground(ColorCnst.WINDOW_BACKGROUND_LIGHT);
51+
footerPanel.setBackground(ColorCnst.WINDOW_BACKGROUND_LIGHT);
52+
4853
// headerPanel.setBorder(MainFrame.redBorder);
4954

5055
}
@@ -54,6 +59,8 @@ private void initView(){
5459
/* ======================= 构造内部Start =====================*/
5560
centerPanel.setLayout(new BorderLayout());
5661
centerPanel.add(headerPanel,BorderLayout.NORTH);
62+
63+
5764
centerPanel.add(bodyPanel,BorderLayout.CENTER);
5865
centerPanel.add(footerPanel,BorderLayout.SOUTH);
5966

355 KB
Loading

0 commit comments

Comments
 (0)