📄 toolkit.java
字号:
native static synchronized int fntGetLeading ( Ptr fmData);native static synchronized int fntGetMaxAdvance ( Ptr fmData);native static synchronized int fntGetMaxAscent ( Ptr fmData);native static synchronized int fntGetMaxDescent ( Ptr fmData);native static synchronized int[] fntGetWidths ( Ptr fmData );native static synchronized Ptr fntInitFont ( String fntSpec, int style, int size );native static synchronized Ptr fntInitFontMetrics ( Ptr fontData);native static synchronized boolean fntIsWideFont ( Ptr fmData);native static synchronized int fntStringWidth ( Ptr fmData, String s );public ColorModel getColorModel () { return null;}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 ) { return new Image( new File( filename));}public Image getImage ( URL url ) { return new Image( url);}public int getMenuShortcutKeyMask() { return InputEvent.CTRL_MASK;}static Ptr getNativeData( Component c) { if ( c instanceof NativeComponent ) return ( (NativeComponent)c).nativeData; else if ( c instanceof NativeContainer ) return ( (NativeContainer)c).nativeData; else return null;}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 Dimension getScreenSize () { return screenSize;}public Clipboard getSystemClipboard () { if ( clipboard == null ) clipboard = new NativeClipboard(); return clipboard;}public EventQueue getSystemEventQueue () { return eventQueue;}native static synchronized void graCleanUpGraphics ( Ptr grData );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(); }}static boolean isInCreateThread () { if ( (flags & IS_DISPATCH_EXCLUSIVE) != 0 ){ if ( (flags & NATIVE_DISPATCHER_LOOP) != 0 ){ if ( Thread.currentThread() != collectorThread ) return false; } else { if ( Thread.currentThread() != eventThread ) return false; } } return true;}native static synchronized Ptr lblCreateLabel( Ptr parent, String text);native static synchronized void lblSetJustify( Ptr data, int adjust);native static synchronized void lblSetText( Ptr data, String text);protected void loadSystemColors ( int[] sysColors ) { clrSetSystemColors( sysColors);}native static synchronized void lstAppendItem( Ptr data, String item);native static synchronized Ptr lstCreateList( Ptr parent, boolean multipleMode);native static synchronized void lstFreeze( Ptr data);native static synchronized int[] lstGetSelectionIdxs( Ptr data);native static synchronized int lstGetVisibleIndex( Ptr data);native static synchronized void lstInsertItem( Ptr data, String item, int idx);native static synchronized void lstRemoveAll( Ptr data);native static synchronized void lstRemoveItem( Ptr data, int idx);native static synchronized void lstReplaceItem( Ptr data, String item, int idx);native static synchronized void lstSelectItem( Ptr data, int idx);native static synchronized void lstSetMultipleMode( Ptr data, boolean mul);native static synchronized void lstThaw( Ptr data);native static synchronized void lstUnselectItem( Ptr data, int idx);native static synchronized void menuAssign ( Ptr owner, Ptr data, int x, int y );native static synchronized void menuCheckItem( Ptr data, MenuItem mi, boolean state );native static synchronized Ptr menuCreateMenu( boolean popup);native static synchronized void menuDeleteMenu ( Ptr data);native static synchronized void menuEnableItem( Ptr data, MenuItem mi, boolean state );native static synchronized void menuInsertItem( Ptr data, Ptr subMenu, String item, int pos, MenuItem mi);native static synchronized void menuRemoveItem( Ptr data, MenuComponent mc );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(); }}native static synchronized Ptr scrollCreateScrollbar( Ptr parent, boolean vert);native static synchronized void scrollSetOrientation( Ptr data, boolean vert);native static synchronized void scrollSetPage( Ptr data, int page);native static synchronized void scrollSetPos( Ptr data, int pos);native static synchronized void scrollSetRange( Ptr data, int min, int max);native static synchronized void scrollSetValues( Ptr data, int pos, int min, int max, int page);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 tlkGetMenubarHeight ();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 widgetCreateWidget( Ptr parent);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 + -