stream frame is now built. frames are now created centered. now show appname on osx instead of com.limelight.limelight

This commit is contained in:
Diego Waxemberg
2013-12-05 21:31:02 -05:00
parent 0f9d597386
commit 18ee201d5a
3 changed files with 37 additions and 4 deletions

View File

@@ -1,6 +1,12 @@
package com.limelight;
import java.net.NetworkInterface;
import java.util.Enumeration;
import javax.swing.JOptionPane;
import javax.swing.JSpinner;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import com.limelight.binding.PlatformBinding;
import com.limelight.gui.MainFrame;
@@ -11,7 +17,7 @@ import com.limelight.nvstream.av.video.VideoDecoderRenderer;
public class Limelight implements NvConnectionListener {
public static final double VERSION = 1.0;
private String host;
private StreamFrame streamFrame;
private NvConnection conn;
@@ -36,6 +42,22 @@ public class Limelight implements NvConnectionListener {
}
public static void main(String args[]) {
// take the menu bar off the jframe
System.setProperty("apple.laf.useScreenMenuBar", "true");
// set the name of the application menu item
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Limelight");
// set the look and feel
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
System.out.println("OH Shit...");
e.printStackTrace();
System.exit(1);
}
MainFrame limeFrame = new MainFrame();
limeFrame.build();
}

View File

@@ -3,6 +3,7 @@ package com.limelight.gui;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
@@ -35,8 +36,9 @@ public class MainFrame {
}
public void build() {
limeFrame = new JFrame("Limelight V" + Limelight.VERSION);
limeFrame = new JFrame("Limelight");
limeFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container mainPane = limeFrame.getContentPane();
mainPane.setLayout(new BorderLayout());
@@ -86,8 +88,10 @@ public class MainFrame {
centerPane.add(contentBox);
mainPane.add(centerPane, "Center");
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
limeFrame.setSize(300, 175);
limeFrame.setLocation(dim.width/2-limeFrame.getSize().width/2, dim.height/2-limeFrame.getSize().height/2);
limeFrame.setResizable(false);
limeFrame.setVisible(true);

View File

@@ -1,11 +1,18 @@
package com.limelight.gui;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
public class StreamFrame extends JFrame {
private static final long serialVersionUID = 1L;
public void build() {
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setSize(1280,720);
//This might break if the screen res is too small...not sure though
this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
this.setVisible(true);
}
}