Skip to content

Commit

Permalink
Updated overall layout code
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dalke committed Feb 3, 2017
1 parent 332d1c1 commit f406117
Show file tree
Hide file tree
Showing 18 changed files with 328 additions and 98 deletions.
281 changes: 198 additions & 83 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file modified out/production/URSS-Telemetry-Manager/UI/Elements/BatteryPane.class
Binary file not shown.
Binary file not shown.
Binary file modified out/production/URSS-Telemetry-Manager/UI/Elements/BottomPane.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified out/production/URSS-Telemetry-Manager/UI/Elements/CommandPane.class
Binary file not shown.
Binary file not shown.
Binary file modified out/production/URSS-Telemetry-Manager/UI/Elements/Log.class
Binary file not shown.
Binary file modified out/production/URSS-Telemetry-Manager/UI/MainInterface.class
Binary file not shown.
28 changes: 28 additions & 0 deletions src/UI/Elements/BatteryPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,39 @@

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

public class BatteryPane extends JPanel {
public BatteryPane() {
TitledBorder title = BorderFactory.createTitledBorder("Battery Monitor");
setBorder(title);

add(new BatteryCanvas());
}

private class BatteryCanvas extends JComponent {
Image batteryImage;

public BatteryCanvas(){
setOpaque(true);
setBackground(Color.black);
setPreferredSize(new Dimension(140,0));
}

public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.setColor(Color.blue);
for (int x = 0; x < getWidth(); x++){
for (int y = 0; y < getHeight(); y++){
if ((x+y) % 11 == 0){
g.drawRect(x,y,1,1);
}
}
}


}
}

}
Expand Down
7 changes: 7 additions & 0 deletions src/UI/Elements/BoatSchematic.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@

package UI.Elements;

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

public class BoatSchematic extends Canvas {
public BoatSchematic() {
setBackground(Color.black);

setPreferredSize(new Dimension(0,140));


}

}
Expand Down
4 changes: 0 additions & 4 deletions src/UI/Elements/BottomPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@

public class BottomPane extends JPanel {

BoatSchematic boatSchematic;
Log log;

public BottomPane() {
setLayout(new BorderLayout());

boatSchematic = new BoatSchematic();
add(boatSchematic,BorderLayout.NORTH);

log = new Log();
add(log,BorderLayout.SOUTH);
}
Expand Down
49 changes: 47 additions & 2 deletions src/UI/Elements/CommandPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,57 @@

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

public class CommandPane extends JPanel {
ThrottlePane throttlePane;
SystemOptionsPane systemPane;

public CommandPane() {

TitledBorder title = BorderFactory.createTitledBorder("Commands");
setBorder(title);
//TitledBorder title = BorderFactory.createTitledBorder("Commands");
//setBorder(title);

setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

throttlePane = new ThrottlePane();
add(throttlePane);

systemPane = new SystemOptionsPane();
add(systemPane);

}

private class ThrottlePane extends JPanel {
public ThrottlePane() {

TitledBorder title = BorderFactory.createTitledBorder("Throttle");
setBorder(title);

JCheckBox throttleLimiter = new JCheckBox("Throttle Limit");
JSpinner throttleLimitPicker = new JSpinner(new SpinnerNumberModel(100,0,100,1));

add(throttleLimiter);
add(throttleLimitPicker);
}
}

private class SystemOptionsPane extends JPanel {
public SystemOptionsPane() {
GridLayout layout = new GridLayout(0,2);
setLayout(layout);

TitledBorder title = BorderFactory.createTitledBorder("System");
setBorder(title);

int i = 0;
for (int x = 0; x <= 1; x++){
for (int y = 0; y <= 4; y++){
JButton button = new JButton("Button "+i++);
add(button);
}
}
}
}

}
Expand Down
43 changes: 43 additions & 0 deletions src/UI/Elements/DataPane.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
////////////////////////////////////////////////
// URSS-Telemetry-Manager
// Chris Dalke
////////////////////////////////////////////////
// Module: CommandPane
////////////////////////////////////////////////

package UI.Elements;

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

public class DataPane extends JPanel {
GraphPane graphPane;
BatteryPane batteryPane;
BoatSchematic boatPane;

public DataPane() {

/*
TitledBorder title = BorderFactory.createTitledBorder("Data");
setBorder(title);
*/

setLayout(new BorderLayout());

batteryPane = new BatteryPane();
graphPane = new GraphPane();
boatPane = new BoatSchematic();

JSplitPane splitPane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, graphPane, boatPane);
JSplitPane splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitPane1, batteryPane);
//splitPane1.setDividerLocation(50.0);
//splitPane2.setDividerLocation(50.0);

add(splitPane2,BorderLayout.CENTER);
}

}

////////////////////////////////////////////////
// End of code
////////////////////////////////////////////////
2 changes: 1 addition & 1 deletion src/UI/Elements/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Log() {
textArea.setEditable(false);
add(scrollPane, BorderLayout.CENTER);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setPreferredSize(new Dimension(0,200));
scrollPane.setPreferredSize(new Dimension(0,140));

PrintStream con=new PrintStream(new TextAreaOutputStream(textArea));
System.setOut(con);
Expand Down
12 changes: 4 additions & 8 deletions src/UI/MainInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
public class MainInterface extends javax.swing.JFrame {

JMenuBar menuBar;
BatteryPane batteryPane;
DataPane dataPane;
CommandPane commandPane;
IndicatorPane indicatorPane;
GraphPane graphPane;
BottomPane bottomPane;


Expand Down Expand Up @@ -52,17 +51,14 @@ public void initComponents(){

setLayout(new BorderLayout());


batteryPane = new BatteryPane();
commandPane = new CommandPane();
indicatorPane = new IndicatorPane();
graphPane = new GraphPane();
bottomPane = new BottomPane();
dataPane = new DataPane();

add(indicatorPane,BorderLayout.NORTH);
add(graphPane,BorderLayout.CENTER);
add(batteryPane,BorderLayout.EAST);
add(commandPane,BorderLayout.WEST);
add(dataPane,BorderLayout.CENTER);
add(commandPane,BorderLayout.EAST);
add(bottomPane,BorderLayout.SOUTH);


Expand Down

0 comments on commit f406117

Please sign in to comment.