summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/examples/splitter/Test.java
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/splitter/Test.java
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/splitter/Test.java')
-rw-r--r--qtjava/javalib/examples/splitter/Test.java97
1 files changed, 97 insertions, 0 deletions
diff --git a/qtjava/javalib/examples/splitter/Test.java b/qtjava/javalib/examples/splitter/Test.java
new file mode 100644
index 00000000..f174bc2b
--- /dev/null
+++ b/qtjava/javalib/examples/splitter/Test.java
@@ -0,0 +1,97 @@
+/***************************************************************************
+* $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.*;
+
+
+
+class Test extends QWidget {
+
+
+Test(QWidget parent, String name)
+{
+ this(parent, name, 0);
+}
+
+Test(QWidget parent, String name, int f)
+{
+ super(parent, name, f);
+
+}
+
+public void paintEvent(QPaintEvent e)
+{
+ QPainter p = new QPainter(this);
+ p.setClipRect(e.rect());
+ int d = 1000; //large number
+ int x1 = 0;
+ int x2 = width()-1;
+ int y1 = 0;
+ int y2 = height()-1;
+
+ int x = (x1+x2)/2;
+ p.drawLine( x, y1, x+d, y1+d );
+ p.drawLine( x, y1, x-d, y1+d );
+ p.drawLine( x, y2, x+d, y2-d );
+ p.drawLine( x, y2, x-d, y2-d );
+
+ int y = (y1+y2)/2;
+ p.drawLine( x1, y, x1+d, y+d );
+ p.drawLine( x1, y, x1+d, y-d );
+ p.drawLine( x2, y, x2-d, y+d );
+ p.drawLine( x2, y, x2-d, y-d );
+ p.end();
+}
+
+
+public static void main(String[] args)
+{
+ QApplication a = new QApplication( args );
+
+ QSplitter s1 = new QSplitter( QSplitter.Vertical, null , "main" );
+
+ QSplitter s2 = new QSplitter( QSplitter.Horizontal, s1, "top" );
+
+ Test t1 = new Test( s2, "topLeft" );
+ t1.setBackgroundColor( Qt.blue().light( 180 ) );
+ t1.setMinimumSize( 50, 0 );
+
+ Test t2 = new Test( s2, "topRight" );
+ t2.setBackgroundColor( Qt.green().light( 180 ) );
+ s2.setResizeMode( t2, QSplitter.KeepSize );
+ s2.moveToFirst( t2 );
+
+ QSplitter s3 = new QSplitter( QSplitter.Horizontal, s1, "bottom" );
+
+ Test t3 = new Test( s3, "bottomLeft" );
+ t3.setBackgroundColor( Qt.red() );
+ Test t4 = new Test( s3, "bottomMiddle" );
+ t4.setBackgroundColor( Qt.white() );
+
+ Test t5 = new Test( s3, "bottomRight" );
+ t5.setMaximumHeight( 250 );
+ t5.setMinimumSize( 80, 50 );
+ t5.setBackgroundColor( Qt.yellow() );
+
+ // Qt/Embedded XOR drawing not yet implemented.
+ s1.setOpaqueResize( true );
+ s2.setOpaqueResize( true );
+ s3.setOpaqueResize( true );
+
+ a.setMainWidget( s1 );
+ s1.setCaption("Qt Example - Splitters");
+ s1.show();
+ int result = a.exec();
+ return;
+}
+ static {
+ qtjava.initialize();
+ }
+}