summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/examples/tabdialog
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /qtjava/javalib/examples/tabdialog
downloadtdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz
tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'qtjava/javalib/examples/tabdialog')
-rw-r--r--qtjava/javalib/examples/tabdialog/Main.java33
-rw-r--r--qtjava/javalib/examples/tabdialog/TabDialog.java114
2 files changed, 147 insertions, 0 deletions
diff --git a/qtjava/javalib/examples/tabdialog/Main.java b/qtjava/javalib/examples/tabdialog/Main.java
new file mode 100644
index 00000000..27a0ef6a
--- /dev/null
+++ b/qtjava/javalib/examples/tabdialog/Main.java
@@ -0,0 +1,33 @@
+/***************************************************************************
+* $Id$
+**
+* Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+* This file is part of an example program for Qt. This example
+* program may be used, distributed and modified without limitation.
+**
+****************************************************************************/
+
+import org.kde.qt.*;
+
+public class Main {
+
+public static void main(String[] args)
+{
+
+ QApplication a = new QApplication( args );
+
+ TabDialog tabdialog = new TabDialog( null, "tabdialog", ( args.length < 1 ? "." : args[0] ) );
+ tabdialog.resize( 450, 350 );
+ tabdialog.setCaption( "Qt Example - Tabbed Dialog" );
+ a.setMainWidget( tabdialog );
+ tabdialog.show();
+
+ a.exec();
+ return;
+}
+
+ static {
+ qtjava.initialize();
+ }
+}
diff --git a/qtjava/javalib/examples/tabdialog/TabDialog.java b/qtjava/javalib/examples/tabdialog/TabDialog.java
new file mode 100644
index 00000000..838bec10
--- /dev/null
+++ b/qtjava/javalib/examples/tabdialog/TabDialog.java
@@ -0,0 +1,114 @@
+/***************************************************************************
+* $Id$
+**
+* Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+* This file is part of an example program for Qt. This example
+* program may be used, distributed and modified without limitation.
+**
+****************************************************************************/
+
+import org.kde.qt.*;
+import java.text.*;
+
+class TabDialog extends QTabDialog
+{
+
+protected String filename;
+protected QFileInfo fileinfo;
+
+
+TabDialog( QWidget parent, String name, String _filename )
+{
+ super( parent, name );
+ filename = _filename;
+ fileinfo = new QFileInfo(filename);
+ setupTab1();
+ setupTab2();
+ setupTab3();
+
+ connect( this, SIGNAL(" applyButtonPressed()"), qApp(), SLOT(" quit()") );
+}
+
+void setupTab1()
+{
+ QVBox tab1 = new QVBox( this );
+ tab1.setMargin( 5 );
+
+ new QLabel( "Filename:", tab1 );
+ QLineEdit fname = new QLineEdit( filename, tab1 );
+ fname.setFocus();
+
+ new QLabel( "Path:", tab1 );
+ QLabel path = new QLabel( fileinfo.dirPath( true ), tab1 );
+ path.setFrameStyle( QFrame.Panel | QFrame.Sunken );
+
+ new QLabel( "Size:", tab1 );
+ QLabel size = new QLabel( fileinfo.size() + " KB", tab1 );
+ size.setFrameStyle( QFrame.Panel | QFrame.Sunken );
+
+ SimpleDateFormat dateFormat = new SimpleDateFormat("EE MMM d hh:mm:ss yyyy");
+
+ new QLabel( "Last Read:", tab1 );
+ QLabel lread = new QLabel( dateFormat.format(fileinfo.lastRead().getTime()), tab1 );
+ lread.setFrameStyle( QFrame.Panel | QFrame.Sunken );
+
+ new QLabel( "Last Modified:", tab1 );
+ QLabel lmodif = new QLabel( dateFormat.format(fileinfo.lastModified().getTime()), tab1 );
+ lmodif.setFrameStyle( QFrame.Panel | QFrame.Sunken );
+
+ addTab( tab1, "General" );
+}
+
+void setupTab2()
+{
+ QVBox tab2 = new QVBox( this );
+ tab2.setMargin( 5 );
+
+ QButtonGroup bg = new QButtonGroup( 1, QGroupBox.Horizontal, "Permissions", tab2 );
+
+ QCheckBox readable = new QCheckBox( "Readable", bg );
+ if ( fileinfo.isReadable() )
+ readable.setChecked( true );
+
+ QCheckBox writable = new QCheckBox( "Writeable", bg );
+ if ( fileinfo.isWritable() )
+ writable.setChecked( true );
+
+ QCheckBox executable = new QCheckBox( "Executable", bg );
+ if ( fileinfo.isExecutable() )
+ executable.setChecked( true );
+
+ QButtonGroup bg2 = new QButtonGroup( 2, QGroupBox.Horizontal, "Owner", tab2 );
+
+ new QLabel( "Owner", bg2 );
+ QLabel owner = new QLabel( fileinfo.owner(), bg2 );
+ owner.setFrameStyle( QFrame.Panel | QFrame.Sunken );
+
+ new QLabel( "Group", bg2 );
+ QLabel group = new QLabel( fileinfo.group(), bg2 );
+ group.setFrameStyle( QFrame.Panel | QFrame.Sunken );
+
+ addTab( tab2, "Permissions" );
+}
+
+void setupTab3()
+{
+ QVBox tab3 = new QVBox( this );
+ tab3.setMargin( 5 );
+ tab3.setSpacing( 5 );
+
+ new QLabel( "Open " + filename + " with:", tab3 );
+
+ QListBox prgs = new QListBox( tab3 );
+ for ( int i = 0; i < 30; i++ ) {
+ String prg = "Application " + i;
+ prgs.insertItem( prg );
+ }
+ prgs.setCurrentItem( 3 );
+
+ new QCheckBox( "Open files with the extension '" + fileinfo.extension() + "' always with this application", tab3 );
+
+ addTab( tab3, "Applications" );
+}
+}