6 * This example shows how to create GUI application which can be run both
7 * as HTML embeded web applet and as standalone application
11 class AppGui
extends JPanel
{
13 setLayout(new java
.awt
.GridLayout(0, 2));
15 JLabel lblVklad
= new JLabel("vklad");
16 final JTextField txtVklad
= new JTextField();
18 JLabel lblMira
= new JLabel("urok. mira");
19 final JTextField txtMira
= new JTextField();
21 JLabel lblRoky
= new JLabel("pocet let");
22 final JTextField txtRoky
= new JTextField();
24 JButton btnGo
= new JButton("Go");
25 final JLabel lblCelkem
= new JLabel("zadej data");
36 btnGo
.addActionListener(new java
.awt
.event
.ActionListener() {
37 public void actionPerformed(java
.awt
.event
.ActionEvent evt
) {
38 double v
= new Double(txtVklad
.getText());
39 double u
= new Double(txtMira
.getText());
40 double r
= new Double(txtRoky
.getText());
41 for(;r
>0;r
--) v
+= v
*(u
/100);
42 lblCelkem
.setText(v
+"");
48 public class Kalkulator
extends JApplet
{
51 getContentPane().add(new AppGui());
54 public static void main(String
[] args
) {
55 JFrame f
= new JFrame("Applet window");
56 f
.setDefaultCloseOperation(javax
.swing
.WindowConstants
.EXIT_ON_CLOSE
);
58 f
.getContentPane().add(new AppGui());
62 // TODO overwrite start(), stop() and destroy() methods
This page took 0.272727 seconds and 4 git commands to generate.