⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toolkit.java

📁 kaffe是一个java虚拟机的源代码。里面包含了一些java例程和标准的java包。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
public ColorModel getColorModel () {	if ( colorModel == null ){		colorModel = clrGetColorModel();	}	return colorModel;}public static Toolkit getDefaultToolkit () {	return singleton;}public String[] getFontList () {	String[] list = { "Default", "Monospaced",	                  "SansSerif", "Serif",			              "Dialog", "DialogInput", "ZapfDingbats" };	return list;}public FontMetrics getFontMetrics ( Font font ) {	return FontMetrics.getFontMetrics( font);}public Image getImage ( String filename ) {	File f = new File( filename);		// Hmm, that's a inconsistency with getImage(URL). The doc isn't very	// helpful, here (class doc says nothing, book tells us it should return	// null in case it's not there - but that is not known a priori for URLs).	// JDK never returns a null object, so we don't do, either	return (f.exists()) ? new Image( f) : Image.getUnknownImage();}public Image getImage ( URL url ) {	// how can we return 'null' before we start to produce this thing (which	// isn't supposed to happen here)? We are NOT going to open the URLConnection	// twice just to check if it is there	return new Image( url);}public int getMenuShortcutKeyMask() {	return InputEvent.CTRL_MASK;}public PrintJob getPrintJob ( Frame frame, String jobtitle, Properties props ) {	return new PSPrintJob( frame, jobtitle, props);}public static String getProperty ( String key, String defaultValue ) {	return null;}public int getScreenResolution() {	return resolution;}public Dimension getScreenSize () {	return screenSize;}public Clipboard getSystemClipboard () {	if ( clipboard == null )		clipboard = new NativeClipboard();			return clipboard;}public EventQueue getSystemEventQueue () {	return eventQueue;}native static synchronized void graAddClip ( Ptr grData, int xClip, int yClip, int wClip, int hClip );native static synchronized void graClearRect ( Ptr grData, int x, int y, int width, int height );native static synchronized void graCopyArea ( Ptr grData, int x, int y, int width, int height,					   int xDelta, int yDelta );native static synchronized void graDraw3DRect ( Ptr grData, int x, int y, int width, int height,		     boolean raised, int rgbValue );native static synchronized void graDrawArc ( Ptr grData, int x, int y, int width, int height, int startAngle, int arcAngle );native static synchronized void graDrawBytes ( Ptr grData, byte[] data, int offset, int length, int x, int y );native static synchronized void graDrawChars ( Ptr grData, char[] data, int offset, int length, int x, int y );native static synchronized void graDrawImage( Ptr grData, Ptr imgData, int src_x, int src_y, int dst_x, int dst_y, int w, int h, int bgval );native static synchronized void graDrawImageScaled ( Ptr grData, Ptr imgData,			  int dx0, int dy0, int dx1, int dy1,			  int sx0, int sy0, int sx1, int sy1, int bgval );native static synchronized void graDrawLine ( Ptr grData, int x1, int y1, int x2, int y2 );native static synchronized void graDrawOval ( Ptr grData, int x, int y, int width, int height );native static synchronized void graDrawPolygon ( Ptr grData, int[] xPoints, int[] yPoints, int nPoints );native static synchronized void graDrawPolyline ( Ptr grData, int[] xPoints, int[] yPoints, int nPoints );native static synchronized void graDrawRect ( Ptr grData, int x, int y, int width, int height );native static synchronized void graDrawRoundRect ( Ptr grData, int x, int y, int width, int height,						int arcWidth, int arcHeight );native static synchronized void graDrawString ( Ptr grData, String s, int x, int y );native static synchronized void graFill3DRect ( Ptr grData, int x, int y, int width, int height,		     boolean raised, int rgbValue );native static synchronized void graFillArc ( Ptr grData, int x, int y, int width, int height, int startAngle, int arcAngle );native static synchronized void graFillOval ( Ptr grData, int x, int y, int width, int height );native static synchronized void graFillPolygon ( Ptr grData, int[] xPoints, int[] yPoints, int nPoints );native static synchronized void graFillRect ( Ptr grData, int x, int y, int width, int height );native static synchronized void graFillRoundRect ( Ptr grData, int x, int y, int width, int height,						int arcWidth, int arcHeight );native static synchronized void graFreeGraphics ( Ptr grData );native static synchronized Ptr graInitGraphics ( Ptr grData, Ptr tgtData, int tgtType,					      int xOffset, int yOffset,					      int xClip, int yClip, int wClip, int hClip,					      Ptr fontData, int fgClr, int bgClr, boolean blank );native static synchronized void graSetBackColor ( Ptr grData, int pixelValue );native static synchronized void graSetClip ( Ptr grData, int xClip, int yClip, int wClip, int hClip );native static synchronized void graSetColor ( Ptr grData, int pixelValue );native static synchronized void graSetFont ( Ptr grData, Ptr fontData );native static synchronized void graSetOffset ( Ptr grData, int xOffset, int yOffset );native static synchronized void graSetPaintMode ( Ptr grData );native static synchronized void graSetVisible ( Ptr grData, boolean isVisible );native static synchronized void graSetXORMode ( Ptr grData, int xClr );native static synchronized void imgComplete ( Ptr imgData, int status );native static synchronized Ptr imgCreateFromData( byte[] buf, int offset, int len);native static synchronized Ptr imgCreateFromFile( String gifPath);native static synchronized Ptr imgCreateImage( int w, int h);native static synchronized Ptr imgCreateScaledImage( Ptr imgData, int w, int h);native static synchronized Ptr imgCreateScreenImage( int w, int h);native static synchronized void imgFreeImage ( Ptr imgData );native static synchronized int imgGetHeight( Ptr imgData);native static synchronized int imgGetLatency ( Ptr imgData );native static synchronized Ptr imgGetNextFrame ( Ptr imgData );native static synchronized int imgGetWidth( Ptr imgData);native static synchronized boolean imgIsMultiFrame( Ptr imgData);native static synchronized void imgProduceImage( ImageNativeProducer prod, Ptr imgData);native static synchronized Ptr imgSetFrame( Ptr imgData, int frame);native static synchronized void imgSetIdxPels( Ptr imgData, int x, int y, int w, int h, int[] rgbs, byte[] pels, int trans, int off, int scans);native static synchronized void imgSetRGBPels( Ptr imgData, int x, int y, int w, int h, int[] rgbs, int off, int scans);static synchronized void initToolkit () {	// this is called when the native layer has been initialized, and it is safe	// to query native settings / rely on native functionality	screenSize = new Dimension( tlkGetScreenWidth(), tlkGetScreenHeight());	resolution = tlkGetResolution();	// we do this here to keep the getDefaultToolkit() method as simple	// as possible (since it might be called frequently). This is a	// deviation from the normal Singleton (which initializes the singleton	// instance upon request)	singleton = new Toolkit();		eventQueue = new EventQueue();/**	if ( Defaults.ConsoleClass != null ){		// since we have to defer the ConsoleWindow until the native Toolkit is propperly		// initialized, it seems to be a good idea to defuse any output to the standard streams		// (which might cause SEGFAULTS on some systems (e.g. DOS)		System.setOut( new PrintStream( NullOutputStream.singleton));		System.setErr( System.out);	}**/	if ( (flags & NATIVE_DISPATCHER_LOOP)	!= 0 ) {		// let the world know we are ready to take over, native-wise		Toolkit.class.notify();	}}protected void loadSystemColors ( int[] sysColors ) {	clrSetSystemColors( sysColors);}public boolean prepareImage ( Image image, int width, int height, ImageObserver observer ) {	return (Image.loadImage( image, width, height, observer));}static void redirectStreams () {	try {		LogClient lv = (LogClient) Class.forName( Defaults.ConsoleClass).newInstance();		LogStream ls = new LogStream( 30, lv);		lv.enable();			System.setOut( new PrintStream( ls) );		System.setErr( System.out);				System.out.println( "Java console enabled");	}	catch ( Exception x ) {		System.err.println( "unable to redirect out, err");		x.printStackTrace();	}}static synchronized void startDispatch () {	if ( eventThread == null ) {		eventThread = new EventDispatchThread( eventQueue);		eventThread.start();				// we defer the Console creation / output redirection up to this point, since we otherwise		// might get all sort of trouble because of a incompletely initialized native layer / Toolkit		if ( Defaults.ConsoleClass != null )			redirectStreams();	}	if ( ((flags & NEEDS_FLUSH) != 0) && (flushThread == null) ){		flushThread = new FlushThread( Defaults.GraFlushRate);		flushThread.start();	}}static synchronized void stopDispatch () {	if ( eventThread != null ) {		eventThread.stopDispatching();		eventThread = null;	}		if ( flushThread != null ){		flushThread.stopFlushing();		flushThread = null;	}}public void sync () {	tlkSync();}static void terminate () {	if ( clipboard != null )		clipboard.dispose();	stopDispatch();	tlkTerminate();}native static synchronized void tlkBeep ();native static synchronized void tlkDisplayBanner ( String banner );native static synchronized void tlkFlush ();native static synchronized int tlkGetResolution ();native static synchronized int tlkGetScreenHeight ();native static synchronized int tlkGetScreenWidth ();native static boolean tlkInit ( String displayName );native static synchronized int tlkProperties();native static synchronized void tlkSync ();native static synchronized void tlkTerminate ();native static synchronized String tlkVersion ();native static synchronized Ptr wndCreateDialog ( Ptr ownerData, String title, int x, int y, int width, int height,		      int cursorType, int bgColor, boolean isResizable );native static synchronized Ptr wndCreateFrame ( String title, int x, int y, int width, int height,		     int cursorType, int bgColor, boolean isResizable );native static synchronized Ptr wndCreateWindow ( Ptr ownerData, int x, int y, int width, int height,		      int cursorType, int bgColor );native static synchronized void wndDestroyWindow ( Ptr wndData );native static synchronized void wndRepaint ( Ptr wndData, int x, int y, int width, int height );native static synchronized void wndRequestFocus ( Ptr wndData );native static synchronized void wndSetBounds ( Ptr wndData, int x, int y, int width, int height, boolean isResizable );native static synchronized void wndSetCursor ( Ptr wndData, int cursorType );native static synchronized int wndSetDialogInsets ( int top, int left, int bottom, int right);native static synchronized int wndSetFrameInsets ( int top, int left, int bottom, int right);native static synchronized void wndSetIcon ( Ptr wndData, Ptr iconData );native static synchronized void wndSetResizable ( Ptr wndData, boolean isResizable,		       int x, int y, int width, int height );native static synchronized void wndSetTitle ( Ptr wndData, String title );native static synchronized void wndSetVisible ( Ptr wndData, boolean showIt );native static synchronized void wndToBack ( Ptr wndData );native static synchronized void wndToFront ( Ptr wndData );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -