Commit 46534b0a authored by angermue's avatar angermue
Browse files

Provides native look and feel feature which can be disabled by using the -n option.

git-svn-id: https://www2.in.tum.de/repos/ttt/trunk@38 0463f305-d864-43cb-8a47-61cf597d4139
parent 8fb893a0
......@@ -41,7 +41,9 @@ public class GradientPanel extends JPanel {
}
public GradientPanel(int orientation) {
vertical = orientation == SwingConstants.VERTICAL;
if (TTT.isEnabledNativeLookAndFeel() == false) {
vertical = orientation == SwingConstants.VERTICAL;
}
}
protected void paintComponent(Graphics g) {
......
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
......@@ -19,19 +22,14 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jPanel3" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="1" max="32767" attributes="0"/>
<Component id="jPanel2" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel4" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="1" max="32767" attributes="0"/>
<Component id="jPanel2" alignment="1" max="32767" attributes="0"/>
<Component id="jPanel4" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="doneButton" min="-2" pref="67" max="-2" attributes="0"/>
......@@ -48,12 +46,12 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" pref="99" max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="doneButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="18" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
......@@ -272,7 +270,7 @@
<Component id="mp4StatusField" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="camStatusField" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="370" max="32767" attributes="0"/>
<EmptySpace pref="435" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="createHelpButton" linkSize="4" min="-2" max="-2" attributes="1"/>
<Component id="createButton" linkSize="4" alignment="1" min="-2" max="-2" attributes="1"/>
......@@ -332,7 +330,7 @@
<Component id="camCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="camStatusField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="22" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
......@@ -354,6 +352,7 @@
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="htmlCheckBox">
......@@ -365,6 +364,7 @@
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="pdfCheckBox">
......@@ -376,6 +376,7 @@
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="ocrCheckBox">
......@@ -387,6 +388,7 @@
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="flashCheckBox">
......@@ -398,6 +400,7 @@
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="createButton">
......@@ -456,6 +459,7 @@
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="mp3StatusField">
......@@ -472,6 +476,7 @@
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="mp4StatusField">
......@@ -488,10 +493,14 @@
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="camStatusField">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="c8" green="d0" red="64" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="not found"/>
</Properties>
</Component>
......@@ -523,7 +532,7 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="openSearchbaseFileDialogButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="85" max="32767" attributes="0"/>
<EmptySpace pref="117" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="importSearchbaseButton" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="searchHelpButton" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
......@@ -554,7 +563,7 @@
<Component id="importSearchbaseButton" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="6" max="32767" attributes="0"/>
<EmptySpace pref="26" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
......@@ -659,12 +668,12 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="userField" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="257" max="32767" attributes="0"/>
<EmptySpace pref="295" max="32767" attributes="0"/>
<Component id="publishHelpButton" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="pathField" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="257" max="32767" attributes="0"/>
<EmptySpace pref="295" max="32767" attributes="0"/>
<Component id="publishButton" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="serverField" linkSize="6" alignment="0" min="-2" pref="238" max="-2" attributes="0"/>
......
......@@ -77,7 +77,7 @@ public class PostProcessorPanel extends GradientPanel {
// create GUI
initComponents();
// set previously used fields
userField.setText(TTT.userPrefs.get("publish_user", "<enter user name>"));
serverField.setText(TTT.userPrefs.get("publish_server", "ttt.in.tum.de"));
......@@ -510,6 +510,8 @@ public class PostProcessorPanel extends GradientPanel {
publishButton = new javax.swing.JButton();
publishHelpButton = new javax.swing.JButton();
setOpaque(false);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Info"));
jPanel1.setOpaque(false);
......@@ -620,22 +622,27 @@ public class PostProcessorPanel extends GradientPanel {
thumbnailsCheckBox.setSelected(true);
thumbnailsCheckBox.setText("Thumbnails");
thumbnailsCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
thumbnailsCheckBox.setOpaque(false);
htmlCheckBox.setSelected(true);
htmlCheckBox.setText("HTML script");
htmlCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
htmlCheckBox.setOpaque(false);
pdfCheckBox.setSelected(true);
pdfCheckBox.setText("PDF script");
pdfCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
pdfCheckBox.setOpaque(false);
ocrCheckBox.setSelected(true);
ocrCheckBox.setText("OCR input");
ocrCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
ocrCheckBox.setOpaque(false);
flashCheckBox.setSelected(true);
flashCheckBox.setText("Flash/SWF");
flashCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
flashCheckBox.setOpaque(false);
createButton.setText("Create");
createButton.setMargin(new java.awt.Insets(0, 8, 0, 8));
......@@ -666,19 +673,23 @@ public class PostProcessorPanel extends GradientPanel {
mp3CheckBox.setSelected(true);
mp3CheckBox.setText("MP3 audio");
mp3CheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
mp3CheckBox.setOpaque(false);
mp3StatusField.setText("not found");
mp4CheckBox.setSelected(true);
mp4CheckBox.setText("MP4 podcast");
mp4CheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
mp4CheckBox.setOpaque(false);
mp4StatusField.setText("not found");
camCheckBox.setSelected(true);
camCheckBox.setText("Cam");
camCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
camCheckBox.setOpaque(false);
camStatusField.setBackground(new java.awt.Color(100, 208, 200));
camStatusField.setText("not found");
org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
......@@ -708,7 +719,7 @@ public class PostProcessorPanel extends GradientPanel {
.add(flashStatusField)
.add(mp4StatusField)
.add(camStatusField))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 370, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 435, Short.MAX_VALUE)
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(createHelpButton)
.add(createButton))))
......@@ -756,7 +767,7 @@ public class PostProcessorPanel extends GradientPanel {
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(camCheckBox)
.add(camStatusField))
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(22, Short.MAX_VALUE))
.add(jPanel2Layout.createSequentialGroup()
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(createButton)
......@@ -821,7 +832,7 @@ public class PostProcessorPanel extends GradientPanel {
.add(searchStatusField))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(openSearchbaseFileDialogButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 85, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 117, Short.MAX_VALUE)
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, importSearchbaseButton)
.add(org.jdesktop.layout.GroupLayout.TRAILING, searchHelpButton))
......@@ -847,7 +858,7 @@ public class PostProcessorPanel extends GradientPanel {
.add(searchHelpButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(importSearchbaseButton)))
.addContainerGap(6, Short.MAX_VALUE))
.addContainerGap(26, Short.MAX_VALUE))
);
jPanel3Layout.linkSize(new java.awt.Component[] {importSearchbaseButton, openSearchbaseFileDialogButton}, org.jdesktop.layout.GroupLayout.VERTICAL);
......@@ -904,11 +915,11 @@ public class PostProcessorPanel extends GradientPanel {
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel4Layout.createSequentialGroup()
.add(userField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 257, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 295, Short.MAX_VALUE)
.add(publishHelpButton))
.add(jPanel4Layout.createSequentialGroup()
.add(pathField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 257, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 295, Short.MAX_VALUE)
.add(publishButton))
.add(serverField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 238, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
......@@ -946,16 +957,13 @@ public class PostProcessorPanel extends GradientPanel {
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
.add(layout.createSequentialGroup()
.add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap()))
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(doneButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(28, 28, 28))))
......@@ -967,12 +975,12 @@ public class PostProcessorPanel extends GradientPanel {
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 99, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(doneButton)
.addContainerGap(18, Short.MAX_VALUE))
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
......
......@@ -26,6 +26,7 @@
package ttt;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
......@@ -108,13 +109,28 @@ public class TTT extends JFrame {
private JDesktopPane desktop;
private static boolean enabledNativeLookAndFeel = true;
private TTT() {
super("TeleTeachingTool - Version " + version);
// TODO: handle CTRL-C
// NOTE: Recorder uses its own handler
// Runtime.getRuntime().addShutdownHook(new ShutDownHook(this));
if (enabledNativeLookAndFeel) {
//try to enable native look and feel
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
enabledNativeLookAndFeel = false;
System.out.println("Error setting native look and feel: " + e);
}
}
fileChooser = new JFileChooser();
if (verbose)
System.out.println(ABOUT);
......@@ -1023,8 +1039,9 @@ public class TTT extends JFrame {
setSize(width, height);
setExtendedState(MAXIMIZED_BOTH);
setVisible(true);
getContentPane().setBackground(Color.WHITE);
showMemoryMonitor(false);
}
}
......@@ -1050,7 +1067,7 @@ public class TTT extends JFrame {
memoryMonitorCheckbox.setSelected(visible);
}
static private final JFileChooser fileChooser = new JFileChooser();
static private JFileChooser fileChooser;// = new JFileChooser();
public static TTT getInstance() {
if (ttt == null) {
......@@ -1313,16 +1330,26 @@ public class TTT extends JFrame {
}
public static void main(String[] args) throws NumberFormatException, IOException {
if (args.length >= 1) {
for (int i = 0; i < args.length; i++) {
// new Recording(args[i]).store();
createFilePlayer(new File(args[0]));
}
return;
} else {
getInstance().showTTT();
// showWizard(true);
}
//parse command line options
for (int i = 0; i < args.length; ++i) {
if (args[i].length() == 2 && args[i].charAt(0) == '-') {
switch (args[i].charAt(1)) {
case 'n':
enabledNativeLookAndFeel = false;
break;
default:
System.out.println("Usage: ttt [options] [recording]\n" +
(char)9 + "-n" + (char)9 + "Disable native look and feel\n" +
(char)9 + "-h" + (char)9 + "Show this message");
System.exit(0);
}
} else {
createFilePlayer(new File(args[i]));
break;
}
}
getInstance().showTTT();
}
// MOD TD
......@@ -1376,4 +1403,8 @@ public class TTT extends JFrame {
}
}
}
public static boolean isEnabledNativeLookAndFeel() {
return enabledNativeLookAndFeel;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment