Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the Java operations included in Matlab?

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "what are the Java operations that come with Matlab", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn "what are the Java operations that come with Matlab".

1 get the position of the mouse in full screen

The upper left corner of the screen is the origin of coordinates. Get the mouse position and get the mouse pixel color suggestion and use the while loop or timer function together:

Import java.awt.MouseInfo;mousepoint=MouseInfo.getPointerInfo () .getLocation (); mousepoint= [mousepoint.x,mousepoint.y] 2 get the current clipboard content import java.awt.Toolkitimport java.awt.datatransfer.DataFlavorclip=Toolkit.getDefaultToolkit () .getSystemClipboard (); clipTf=clip.getContents ([]); clipContent=clipTf.getTransferData (DataFlavor.stringFlavor) 3 content copied to clipboard import java.awt.Toolkit;import java.awt.datatransfer.StringSelection;clip=Toolkit.getDefaultToolkit () .getSystemClipboard (); contentStr=' welcome to follow slandarer essay'; tText=StringSelection (contentStr) Clip.setContents (tText, []); 4 get the pixel color at the mouse

It needs to be combined with a function that gets the mouse position.

Import java.awt.MouseInfo;import java.awt.Robot;robot=Robot (); mousepoint=MouseInfo.getPointerInfo (). GetLocation (); tempColor=robot.getPixelColor (mousepoint.x, mousepoint.y); RGBColor= [tempColor.getRed (), tempColor.getGreen (), tempColor.getBlue ()] 5 to get screenshots import java.awt.Robot;import java.awt.Rectangle;robot=Robot (); rectangle=Rectangle (); screensize=get (0focus screenshots); screensize=1.5*screensize;rectangle.x=0;rectangle.y=0;rectangle.width=screensize (3); rectangle.height=screensize (4) Image=robot.createScreenCapture (rectangle); data=image.getData (); temp=zeros (screensize (3) * screensize (4) * 3Power1); temp=data.getPixels (0Lot0) screensize (3), screensize (4), temp); temp=uint8 (temp); R=temp (1:3:end); G=temp (2:3:end); B=temp (3:3:end); R=reshape (R, [screensize (3), screensize (4)]); G=reshape (G, [screensize (3), screensize (4)]); B=reshape (B, [screensize (3), screensize (4)]) Imshow (ima) 6 creates a java window (and keeps it on top forever) import java.awt.Frame;import java.awt.Point;frame=Frame ();% sets java window size frame.setSize (400300)% sets java window position point=Point (300200); frame.setLocation (point)% makes it always on top frame.setAlwaysOnTop (true) % setting window closes callback (java frame cannot be closed without setting) hjWindow=handle (frame,'CallbackProperties'); set (hjWindow,'WindowClosingCallback',@ (hpene) frame.dispose ());% display java window frame.setVisible (true) 7 transparent window import java.awt.Frame;import java.awt.Point;import java.awt.Button;import java.awt.Font;frame=Frame () % set java window size frame.setSize (400200)% set java window position point=Point (50400); frame.setLocation (point)% because you want to set button position according to numerical value, so setLayout (NULL) frame.setLayout ([]); bt1=Button ("click me to try"); bt2=Button ("close window");% set click event hbt1=handle (bt1,'CallbackProperties') Set (hbt1,'MousePressedCallback',@ (hpene) disp ('welcome to the official account slandarer essay') hbt2=handle (bt2,'CallbackProperties'); set (hbt2,'MousePressedCallback',@ (hpene) frame.dispose ())% set button font and font size mf=Font ('Verdana', Font.BOLD,25); bt1.setFont (mf) bt2.setFont (mf)% set button position bt1.setLocation (305030); bt1.setSize (140140); bt2.setLocation (220d30); bt2.setSize (140140) % add button frame.add (bt1); frame.add (bt2);% unborder and set transparency frame.setUndecorated (true); frame.setOpacity (.7);% Settings window close callback hjWindow=handle (frame, 'CallbackProperties'); set (hjWindow,' WindowClosingCallback', @ (hjinger) frame.dispose ());% display java window frame.setVisible (true)

The above is all the contents of the article "what are the Java operations included in Matlab?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report