All pastes #282575 Raw Edit

Miscellany

public text v1 · immutable
#282575 ·published 2006-12-17 18:23 UTC
rendered paste body
import static javax.swing.JOptionPane.*;
class Tekstkon {
	static String a;
	static int valg;
	static int teller = 0;
	static int tellera = 0;
	static int confirm;
	public static void main ( String [] args ) {
		do{
			a = showInputDialog(null,"Skriv inn teksten din");
			do{
				String[] muligheter = {"Finn Lengde","Gjør til store bokstaver", "Gjør til små bokstaver", "Ny tekst", "Avslutt program"};
				valg = showOptionDialog(null,a , "Hva ønsker du å gjøre?", 0, PLAIN_MESSAGE, null,muligheter,muligheter[0]);

				if (valg == 0) {
					showMessageDialog(null, "Teksten " + a + " består av " + a.length() + " tegn");
				} else if (valg == 1) {
					showMessageDialog(null,"Teksten i store bokstaver: " + a.toUpperCase());
				} else if (valg == 2) {
					showMessageDialog(null,"Teksten i små bokstaver: " + a.toLowerCase());
				} else if (valg == 3) {
					tellera++;
				}else if (valg == 4) {
					confirm = showConfirmDialog(null, "Ønsker du virkelig avslutte?","Avslutte", YES_NO_OPTION);
					if ( confirm == YES_OPTION ) {
						teller++;
						tellera++;
					} else if ( confirm == NO_OPTION ) {
						teller = teller;
						tellera = teller;
					}
				}
			} while (tellera != 1 || tellera < 1);
			tellera --;
		} while (teller != 1 || teller < 1);
		System.out.println("Systemet ble avsluttet");
		System.exit(0);
	}
}