Gå til innhold

Hva skjuler det seg bak din Ctrl+v?


Anbefalte innlegg

Videoannonse
Annonse

Eksempelkode fra java

 

 

package test;

/*
* TableDemo.java requires no other files.
*/

import javax.swing.*;
import javax.swing.ListSelectionModel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import java.awt.Dimension;
import java.awt.GridLayout;

/** 
* TableDemo is just like SimpleTableDemo, except that it
* uses a custom TableModel.
*/
public class TableDemo extends JPanel {
private boolean DEBUG = false;

public TableDemo() {
	super(new GridLayout(1,0));

	JTable table = new JTable(new MyTableModel());
	table.setPreferredScrollableViewportSize(new Dimension(500, 70));
	table.setFillsViewportHeight(true);
	table.setCellSelectionEnabled(true);

	//Create the scroll pane and add the table to it.
	JScrollPane scrollPane = new JScrollPane(table);

	//Add the scroll pane to this panel.
	add(scrollPane);
}

class MyTableModel extends AbstractTableModel {
	private String[] columnNames = {"First Name",
									"Last Name",
									"Sport",
									"# of Years",
									"Vegetarian"};
	private Object[][] data = {
		{"Mary", "Campione",
		 "Snowboarding", new Integer(5), new Boolean(false)},
		{"Alison", "Huml",
		 "Rowing", new Integer(3), new Boolean(true)},
		{"Kathy", "Walrath",
		 "Knitting", new Integer(2), new Boolean(false)},
		{"Sharon", "Zakhour",
		 "Speed reading", new Integer(20), new Boolean(true)},
		{"Philip", "Milne",
		 "Pool", new Integer(10), new Boolean(false)},
	};

	public int getColumnCount() {
		return columnNames.length;
	}

	public int getRowCount() {
		return data.length;
	}

	public String getColumnName(int col) {
		return columnNames[col];
	}

	public Object getValueAt(int row, int col) {
		return data[row][col];
	}

	/*
	 * JTable uses this method to determine the default renderer/
	 * editor for each cell.  If we didn't implement this method,
	 * then the last column would contain text ("true"/"false"),
	 * rather than a check box.
	 */
	public Class getColumnClass(int c) {
		return getValueAt(0, c).getClass();
	}

	/*
	 * Don't need to implement this method unless your table's
	 * editable.
	 */
	public boolean isCellEditable(int row, int col) {
		//Note that the data/cell address is constant,
		//no matter where the cell appears onscreen.
		if (col < 2) {
			return false;
		} else {
			return true;
		}
	}

	/*
	 * Don't need to implement this method unless your table's
	 * data can change.
	 */
	public void setValueAt(Object value, int row, int col) {
		if (DEBUG) {
			System.out.println("Setting value at " + row + "," + col
							   + " to " + value
							   + " (an instance of "
							   + value.getClass() + ")");
		}

		data[row][col] = value;
		fireTableCellUpdated(row, col);

		if (DEBUG) {
			System.out.println("New value of data:");
			printDebugData();
		}
	}

	private void printDebugData() {
		int numRows = getRowCount();
		int numCols = getColumnCount();

		for (int i=0; i < numRows; i++) {
			System.out.print("	row " + i + ":");
			for (int j=0; j < numCols; j++) {
				System.out.print("  " + data[i][j]);
			}
			System.out.println();
		}
		System.out.println("--------------------------");
	}
}

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
private static void createAndShowGUI() {
	//Create and set up the window.
	JFrame frame = new JFrame("TableDemo");
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	//Create and set up the content pane.
	TableDemo newContentPane = new TableDemo();
	newContentPane.setOpaque(true); //content panes must be opaque
	frame.setContentPane(newContentPane);

	//Display the window.
	frame.pack();
	frame.setVisible(true);
}

public static void main(String[] args) {
	//Schedule a job for the event-dispatching thread:
	//creating and showing this application's GUI.
	javax.swing.SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			createAndShowGUI();
		}
	});
}
}

 

Endret av Fluesoppen
Lenke til kommentar

Min ctrl-V:

 

Spørsmål 2: Kva tolkingsprinsipp skal leggast til grunn i høve til Svalbardtraktaten?

Spørsmål 3: Har Noreg høve til å oppretta full økonomisk sone kring Svalbard og driva forskjellshandsaming basert på nasjonalitet i denne?

 

Satt visst og skreiv oppgåve :)

Lenke til kommentar

WorldWideWeb

Erwise

ViolaWWW

Mosaic

Netscape Navigator

Internet Explorer

Opera

Mozilla Firefox

AMosaic

Arena

Cello

CyberDog

Grail

IBM Web Explorer

Lynx

MacWeb

MidasWWW

Oracle PowerBrowser

SlipKnot

WebRouser

Maxthon (formerly known as MyIE2)

Netscape Browser 8

AOL Explorer

Altimit OS Web Browser

Avant Browser

Bento Browser (Built into Winamp)

Enigma

Maxthon

Slim Browser

NeoPlanet

NetCaptor

Many other Internet Explorer shells

Yahoo! Browser (or partnership browsers eg. "AT&T Yahoo! Browser"; "Verizon Yahoo! Browser"; "BT Yahoo! Browser" etc.)

iRider

Smart Bro

UltraBrowser

Alefox

Beonex Communicator

Camino for Mac OS X (formerly Chimera)

CompuServe

DocZilla, a SGML browser

Epiphany, GNOME's current default browser

Flock (based on Firefox)

Galeon, GNOME's former default browser

IceWeasel, Debian's free fork of Firefox

K-Meleon for Windows

K-MeleonCCF for Windows (based on K-Meleon)

K-Ninja for Windows (based on K-Meleon)

Kazehakase, a very light GTK2 web browser for GNU/Linux

Madfox (based on Firefox)

ManyOne

Mozilla Firefox (formerly Firebird and Phoenix)

Netscape (version 6 and newer)

SeaMonkey (internal name for Mozilla Application Suite, now the public name)

Skipstone

XeroBank Browser (formerly Torpark), portable browser for anonymous browsing

Deepnet (Built with p2p)

uBrowser 3D Browser using LLMozLib

ABrowse

Web Browser for Android (mobile phone platform)

iCab (version 4 uses WebKit; earlier versions used its own rendering engine)

Epiphany, GNOME's current default browser

Konqueror

LimeChat

Midori

OmniWeb

Safari

Web Browser for S60 (for mobile)

Shiira

Sunrise

Swift

Opera

Nintendo DS Browser ( Opera Powered)

Internet Channel (Web browser for the Wii console) (Opera powered)

HotJava (discontinued)

Lobo

X-Smiles

Flock (To enhance blogging, photosharing, and RSS newsreading)

Ghostzilla (Blends into the GUI to hide activity)

Songbird (software) (browser with advanced audio streaming features and built in media player with library.)

SpaceTime (Search the web in 3D)

Wyzo (A media browser that integrates BitTorrent)

AOL (For use with their proprietary intranet)

3B (3D browser)

Abaco (for Plan 9 from Bell Labs)

Amaya

Arachne (DOS)

AWeb

Charon (for Inferno)

Dillo (Small, fast, free, minimalistic, and multi-platform)

Emacs/W3

Gollum browser

IBrowse

Krozilo

Mothra (for Plan 9 from Bell Labs)

NetPositive

NetSurf (An open source web browser for RISC OS and GTK+ written in C)

Oregano

Planetweb browser (discont. for Dreamcast)

Sleipnir

Tkhtml

VMS Mosaic

Voyager

Abaco

Alynx

cURL (Line-mode browser)

DosLynx

ELinks (active version of Links)

Links (not currently active)

Lynx

Net-Tamer

w3m

WebbIE

wget (Line-mode browser)

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...