Source Code Cross Referenced for DialDemo3.java in  » Chart » jfreechart » org » jfree » experimental » chart » demo » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Chart » jfreechart » org.jfree.experimental.chart.demo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* --------------
002:         * DialDemo3.java
003:         * --------------
004:         * (C) Copyright 2006, by Object Refinery Limited.
005:         */
006:
007:        package org.jfree.experimental.chart.demo;
008:
009:        import java.awt.BasicStroke;
010:        import java.awt.BorderLayout;
011:        import java.awt.Color;
012:        import java.awt.Dimension;
013:        import java.awt.GradientPaint;
014:        import java.awt.Point;
015:
016:        import javax.swing.JFrame;
017:        import javax.swing.JPanel;
018:        import javax.swing.JSlider;
019:        import javax.swing.event.ChangeEvent;
020:        import javax.swing.event.ChangeListener;
021:
022:        import org.jfree.chart.ChartPanel;
023:        import org.jfree.chart.JFreeChart;
024:        import org.jfree.data.general.DefaultValueDataset;
025:        import org.jfree.experimental.chart.plot.dial.DialBackground;
026:        import org.jfree.experimental.chart.plot.dial.DialPlot;
027:        import org.jfree.experimental.chart.plot.dial.DialPointer;
028:        import org.jfree.experimental.chart.plot.dial.StandardDialFrame;
029:        import org.jfree.experimental.chart.plot.dial.StandardDialScale;
030:        import org.jfree.ui.GradientPaintTransformType;
031:        import org.jfree.ui.StandardGradientPaintTransformer;
032:
033:        /**
034:         * A sample application showing the use of a {@link DialPlot}.
035:         */
036:        public class DialDemo3 extends JFrame implements  ChangeListener {
037:
038:            /** A slider to update the dataset value. */
039:            JSlider slider;
040:
041:            /** The dataset. */
042:            DefaultValueDataset dataset;
043:
044:            /** 
045:             * Creates a new instance.
046:             * 
047:             * @param title  the frame title.
048:             */
049:            public DialDemo3(String title) {
050:                super (title);
051:
052:                this .dataset = new DefaultValueDataset(50);
053:                // get data for diagrams
054:                DialPlot plot = new DialPlot();
055:                plot.setView(0.21, 0.0, 0.58, 0.30);
056:                plot.setDataset(this .dataset);
057:
058:                StandardDialFrame dialFrame = new StandardDialFrame(60.0, 60.0);
059:                dialFrame.setInnerRadius(0.60);
060:                dialFrame.setOuterRadius(0.90);
061:                dialFrame.setForegroundPaint(Color.darkGray);
062:                dialFrame.setStroke(new BasicStroke(3.0f));
063:                plot.setDialFrame(dialFrame);
064:
065:                GradientPaint gp = new GradientPaint(new Point(), new Color(
066:                        255, 255, 255), new Point(), new Color(240, 240, 240));
067:                DialBackground sdb = new DialBackground(gp);
068:                sdb
069:                        .setGradientPaintTransformer(new StandardGradientPaintTransformer(
070:                                GradientPaintTransformType.VERTICAL));
071:                plot.addLayer(sdb);
072:
073:                StandardDialScale scale = new StandardDialScale(0, 100, 115.0,
074:                        -50.0);
075:                scale.setTickRadius(0.88);
076:                scale.setTickLabelOffset(0.07);
077:                scale.setMajorTickIncrement(25.0);
078:                scale.setTickLabelPaint(null);
079:                plot.addScale(0, scale);
080:
081:                DialPointer needle = new DialPointer.Pin();
082:                needle.setRadius(0.82);
083:                plot.addLayer(needle);
084:                JFreeChart chart1 = new JFreeChart(plot);
085:                chart1.setTitle("Dial Demo 3");
086:                ChartPanel cp1 = new ChartPanel(chart1);
087:
088:                cp1.setPreferredSize(new Dimension(400, 250));
089:                this .slider = new JSlider(0, 100);
090:                this .slider.setMajorTickSpacing(10);
091:                this .slider.setPaintLabels(true);
092:                this .slider.addChangeListener(this );
093:                JPanel content = new JPanel(new BorderLayout());
094:                content.add(cp1);
095:                content.add(this .slider, BorderLayout.SOUTH);
096:                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
097:                setContentPane(content);
098:
099:            }
100:
101:            /**
102:             * Handle a change in the slider by updating the dataset value.  This
103:             * automatically triggers a chart repaint.
104:             * 
105:             * @param e  the event.
106:             */
107:            public void stateChanged(ChangeEvent e) {
108:                this .dataset.setValue(new Integer(this .slider.getValue()));
109:            }
110:
111:            /**
112:             * Starting point for the demo application.
113:             * 
114:             * @param args  ignored.
115:             */
116:            public static void main(String[] args) {
117:
118:                DialDemo3 app = new DialDemo3("JFreeChart - Demo Dial 3");
119:                app.pack();
120:                app.setVisible(true);
121:
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.