Skip to content
Snippets Groups Projects
Commit 1f183cdc authored by joalhelk's avatar joalhelk
Browse files

changed images and welcomePage nav panel to clickable items

parent c66438ce
No related branches found
No related tags found
No related merge requests found
Showing with 65 additions and 12 deletions
...@@ -25,8 +25,11 @@ public class LoginPage implements ActionListener{ ...@@ -25,8 +25,11 @@ public class LoginPage implements ActionListener{
private JPasswordField passwordField; private JPasswordField passwordField;
private JPanel bottomPanel; private JPanel bottomPanel;
private JLabel imageLabel; private JLabel imageLabel;
private ImageIcon lightImageOff = new ImageIcon("src/main/resources/images/lightbulb_off.png"); private ImageIcon lightImageOff = new ImageIcon("src/main/resources/images/lightbulb_1.png");
private ImageIcon lightImageOn = new ImageIcon("src/main/resources/images/lightbulb_on.png"); private ImageIcon lightImageWarming = new ImageIcon("src/main/resources/images/lightbulb_2.png");
private ImageIcon lightImageWarm = new ImageIcon("src/main/resources/images/lightbulb_3.png");
private ImageIcon lightImageHotter = new ImageIcon("src/main/resources/images/lightbulb_4.png");
private ImageIcon lightImageHot = new ImageIcon("src/main/resources/images/lightbulb_5.png");
private final int width = 800, height = 420; private final int width = 800, height = 420;
private final int[] retry_intervals = {5, 15, 30, 60, 180}; private final int[] retry_intervals = {5, 15, 30, 60, 180};
...@@ -63,7 +66,7 @@ public class LoginPage implements ActionListener{ ...@@ -63,7 +66,7 @@ public class LoginPage implements ActionListener{
retryLabel.setFont(new Font(null, Font.ITALIC, 15)); retryLabel.setFont(new Font(null, Font.ITALIC, 15));
retryLabel.setForeground(Color.red); retryLabel.setForeground(Color.red);
imageLabel.setBackground(Color.black); imageLabel.setBackground(Color.black);
imageLabel.setBounds(80,0, width, height-100); imageLabel.setBounds(80,30, width, height-100);
userIDField.setBounds(125,100,200,25); userIDField.setBounds(125,100,200,25);
loginButton.setBounds(225,188,100,25); loginButton.setBounds(225,188,100,25);
...@@ -123,7 +126,7 @@ public class LoginPage implements ActionListener{ ...@@ -123,7 +126,7 @@ public class LoginPage implements ActionListener{
// Sets the lightbulb image on // Sets the lightbulb image on
private void setLightBulbOn() { private void setLightBulbOn() {
imageLabel.setIcon(resizeIcon(lightImageOn, 255, 343)); imageLabel.setIcon(resizeIcon(lightImageHot, 255, 343));
} }
// Resize the given image to given width and height // Resize the given image to given width and height
......
...@@ -3,12 +3,15 @@ package com.joelhelkala.watcherGui.frames; ...@@ -3,12 +3,15 @@ package com.joelhelkala.watcherGui.frames;
import java.awt.*; import java.awt.*;
import javax.swing.*; import javax.swing.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import com.joelhelkala.watcherGui.User.User; import com.joelhelkala.watcherGui.User.User;
import com.joelhelkala.watcherGui.frames.panels.LineChartPanel; import com.joelhelkala.watcherGui.frames.panels.LineChartPanel;
import com.joelhelkala.watcherGui.frames.panels.ProgressBarCirclePanel; import com.joelhelkala.watcherGui.frames.panels.ProgressBarCirclePanel;
import com.joelhelkala.watcherGui.frames.panels.TemperaturePanel; import com.joelhelkala.watcherGui.frames.panels.TemperaturePanel;
public class WelcomePage { public class WelcomePage implements MouseListener {
private static final int width = 1200, height = 750; private static final int width = 1200, height = 750;
private static final int topPanelHeight = height/10; private static final int topPanelHeight = height/10;
...@@ -21,6 +24,11 @@ public class WelcomePage { ...@@ -21,6 +24,11 @@ public class WelcomePage {
private static final Color darkwhite = new Color(96, 96, 96); private static final Color darkwhite = new Color(96, 96, 96);
private static final Color dark = new Color(33, 33, 33); private static final Color dark = new Color(33, 33, 33);
private final JLabel nodeDataLabel;
private final JLabel nodeSettingsLabel;
private final JLabel friendsLabel;
public WelcomePage(){ public WelcomePage(){
JPanel topPanel = new JPanel(); JPanel topPanel = new JPanel();
topPanel.setBackground(dark); topPanel.setBackground(dark);
...@@ -81,7 +89,7 @@ public class WelcomePage { ...@@ -81,7 +89,7 @@ public class WelcomePage {
topPanel.add(userLabel); topPanel.add(userLabel);
JLabel iconLabel = new JLabel(); JLabel iconLabel = new JLabel();
iconLabel.setBounds(20,10,50,50); iconLabel.setBounds(20,10,50,50);
ImageIcon image = new ImageIcon("src/main/resources/images/lightbulb_on.png"); ImageIcon image = new ImageIcon("src/main/resources/images/lightbulb_5.png");
iconLabel.setIcon(LoginPage.resizeIcon(image, 50, 50)); iconLabel.setIcon(LoginPage.resizeIcon(image, 50, 50));
topPanel.add(iconLabel); topPanel.add(iconLabel);
JLabel titleLabel = new JLabel("WATCHER"); JLabel titleLabel = new JLabel("WATCHER");
...@@ -91,25 +99,31 @@ public class WelcomePage { ...@@ -91,25 +99,31 @@ public class WelcomePage {
frame.getContentPane().add(leftPanel); frame.getContentPane().add(leftPanel);
leftPanel.setLayout(null); leftPanel.setLayout(null);
JLabel nodeDataLabel = new JLabel("Node data"); nodeDataLabel = new JLabel("Node data");
nodeDataLabel.setHorizontalAlignment(SwingConstants.CENTER); nodeDataLabel.setHorizontalAlignment(SwingConstants.CENTER);
nodeDataLabel.setFont(new Font("Apple SD Gothic Neo", Font.PLAIN, 16)); nodeDataLabel.setFont(new Font("Apple SD Gothic Neo", Font.PLAIN, 16));
nodeDataLabel.setBounds(64, 57, 98, 16); nodeDataLabel.setBounds(0, 41, 240, 32);
nodeDataLabel.setForeground(Color.WHITE); nodeDataLabel.setForeground(Color.WHITE);
nodeDataLabel.addMouseListener(this);
nodeDataLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
leftPanel.add(nodeDataLabel); leftPanel.add(nodeDataLabel);
JLabel nodeSettingsLabel = new JLabel("Node settings"); nodeSettingsLabel = new JLabel("Node settings");
nodeSettingsLabel.setHorizontalAlignment(SwingConstants.CENTER); nodeSettingsLabel.setHorizontalAlignment(SwingConstants.CENTER);
nodeSettingsLabel.setForeground(Color.WHITE); nodeSettingsLabel.setForeground(Color.WHITE);
nodeSettingsLabel.setFont(new Font("Apple SD Gothic Neo", Font.PLAIN, 16)); nodeSettingsLabel.setFont(new Font("Apple SD Gothic Neo", Font.PLAIN, 16));
nodeSettingsLabel.setBounds(64, 110, 98, 16); nodeSettingsLabel.setBounds(0, 110, 240, 32);
nodeSettingsLabel.addMouseListener(this);
nodeSettingsLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
leftPanel.add(nodeSettingsLabel); leftPanel.add(nodeSettingsLabel);
JLabel friendsLabel = new JLabel("Friends"); friendsLabel = new JLabel("Friends");
friendsLabel.setHorizontalAlignment(SwingConstants.CENTER); friendsLabel.setHorizontalAlignment(SwingConstants.CENTER);
friendsLabel.setForeground(Color.WHITE); friendsLabel.setForeground(Color.WHITE);
friendsLabel.setFont(new Font("Apple SD Gothic Neo", Font.PLAIN, 16)); friendsLabel.setFont(new Font("Apple SD Gothic Neo", Font.PLAIN, 16));
friendsLabel.setBounds(64, 163, 98, 16); friendsLabel.setBounds(0, 163, 240, 32);
friendsLabel.addMouseListener(this);
friendsLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
leftPanel.add(friendsLabel); leftPanel.add(friendsLabel);
JLabel helpLabel = new JLabel("Help"); JLabel helpLabel = new JLabel("Help");
...@@ -131,4 +145,40 @@ public class WelcomePage { ...@@ -131,4 +145,40 @@ public class WelcomePage {
frame.setVisible(true); frame.setVisible(true);
} }
@Override
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent arg0) {
Object target = arg0.getSource();
if (target == nodeDataLabel) nodeDataLabel.setForeground(lightgray);
else if (target == nodeSettingsLabel) nodeSettingsLabel.setForeground(lightgray);
else if (target == friendsLabel) friendsLabel.setForeground(lightgray);
}
@Override
public void mouseExited(MouseEvent arg0) {
Object target = arg0.getSource();
if (target == nodeDataLabel) nodeDataLabel.setForeground(Color.WHITE);
else if (target == nodeSettingsLabel) nodeSettingsLabel.setForeground(Color.WHITE);
else if (target == friendsLabel) friendsLabel.setForeground(Color.WHITE);
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
} }
\ No newline at end of file
WatcherGui/src/main/resources/images/lightbulb_1.png

59.9 KiB

WatcherGui/src/main/resources/images/lightbulb_2.png

65.2 KiB

WatcherGui/src/main/resources/images/lightbulb_3.png

68.4 KiB

WatcherGui/src/main/resources/images/lightbulb_4.png

72.9 KiB

WatcherGui/src/main/resources/images/lightbulb_5.png

106 KiB

WatcherGui/src/main/resources/images/lightbulb_off.png

145 KiB

WatcherGui/src/main/resources/images/lightbulb_on.png

179 KiB

WatcherGui/src/main/resources/images/lightbulb_warm.png

181 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment