真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

ui的java代碼 ui java

ligerui使用loadData動態(tài)加載樹節(jié)點時,struts2的java代碼怎么寫

方法很簡單。插件中是將數(shù)據(jù)寫死在js里面的。只要是這個格式即可。所以在你從后臺把數(shù)據(jù)從數(shù)據(jù)庫讀取出來后。按照tree需要的這個格式,把數(shù)據(jù)拼接成這個格式。通過ajax傳回前臺再調(diào)用綁定方法即可。

蘇尼特右網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)公司!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、響應式網(wǎng)站等網(wǎng)站項目制作,到程序開發(fā),運營維護。成都創(chuàng)新互聯(lián)公司于2013年創(chuàng)立到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設(shè)就選成都創(chuàng)新互聯(lián)公司。

讀取數(shù)據(jù)-組成需要的格式-傳到前臺js中-再執(zhí)行tree的綁定方法調(diào)用即可。

如何在另一個類中調(diào)用已經(jīng)寫好的UiAutomator Java代碼中的方法

如果你使用Eclipse可以直接new UiAutomator對象,例如Uiautomator ui = new Uiautomator(),調(diào)用方法幾時ui.方法名。

調(diào)用其他類的方法名一般是新建對象,然后通過對象加“.”調(diào)用方法。如果是靜態(tài)方法就直接類名.方法

java的UI程序 簡單 排錯

問題出在KeyEvent上。請注意你的MAIN類的名字叫KeyEvent,而MyKeyMonitor類重寫的方法keyPressed的入?yún)⒌念愋鸵彩荎eyEvent(這個KeyEvent應該是java.awt.event包下的),也就是說,當你的MAIN類和MyKeyMonitor在同一包內(nèi)時,當觸發(fā)keyPressed事件時,JAVA會自動去生成你MAIN類的實體,不會去生成java.awt.event包下的正確的KeyEvent實體,所以,你的程序才不能正確的捕獲產(chǎn)生的鍵盤事件。

解決的方法有兩個,一個是改變你MAIN類的名字,二是指明MyKeyMonitor類keyPressed方法入?yún)⒌拿鞔_包,即寫成public void keyPressed(java.awt.event.KeyEvent e) {

Java代碼運行器

import java awt BorderLayout;

import java awt Color;

import java awt EventQueue;

import java awt event ActionEvent;

import java awt event ActionListener;

import java io BufferedReader;

import java io BufferedWriter;

import java io File;

import java io FileInputStream;

import java io FileOutputStream;

import java io InputStreamReader;

import java io OutputStreamWriter;

import javax swing JButton;

import javax swing JColorChooser;

import javax swing JFileChooser;

import javax swing JFrame;

import javax swing JLabel;

import javax swing JMenu;

import javax swing JMenuBar;

import javax swing JMenuItem;

import javax swing JOptionPane;

import javax swing JPanel;

import javax swing JScrollPane;

import javax swing JTextArea;

import javax swing JTextField;

import javax swing JTextPane;

import javax swing SwingUtilities;

import javax swing UIManager;

import javax swing border EtchedBorder;

import javax swing text BadLocationException;

import javax swing text Document;

import javax swing text SimpleAttributeSet;

import javax swing text StyleConstants;

import javax swing text StyledEditorKit;

public class RunJava extends JFrame {

private JTextField textField_ ;

private JTextField textField;

private String url = System getProperty( user dir ) + \\ ;

private JTextPane textArea_ ;

private JTextArea textArea;

private static String cmd = first ;

private static Process pro = null;

private Thread InPutThread = null;

private Thread OutPutThread = null;

private Thread ErrorThread = null;

private JMenu File Edit;

private JMenuBar Part;

private JMenuItem Open InsertMain SaveAs Save Exit MarkColor;

private File file;

private String [] Keyword = { abstract default if private this boolean do implements protected throw break double import public throws byte else instanceof return transient case extends int short try catch final interface static void char finally long strictfp volatile class float native super while const for new switch continue goto package synchronized };

public static void main(String args[]) {

EventQueue invokeLater(new Runnable() {

public void run() {

try {

RunJava frame = new RunJava();

frame setVisible(true);

} catch (Exception e) {

e printStackTrace();

}

}

});

}

public RunJava() throws Exception {

super( Java代碼運行器 );

File = new JMenu( 文件 );

Part = new JMenuBar();

Edit = new JMenu( 編輯 );

Part add(File);

Part add(Edit);

Open = new JMenuItem( 打開 );

Open addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg ) {

JFileChooser fileChooser = new JFileChooser(); // 實例化文件選擇器

fileChooser setFileSelectionMode(JFileChooser FILES_AND_DIRECTORIES); // 設(shè)置文件選擇模式 此處為文件和目錄均可

if (fileChooser showOpenDialog(RunJava this) == JFileChooser APPROVE_OPTION) { // 彈出文件選擇器 并判斷是否點擊了打開按鈕

String fileName = fileChooser getSelectedFile() getAbsolutePath(); // 得到選擇文件或目錄的絕對路徑

System out println(fileName);

file = new File(fileName);

InputData();

}

}

});

Save = new JMenuItem( 保存 );

Save addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg ) {

if(file==null){

JFileChooser fileChooser = new JFileChooser(); // 實例化文件選擇器

fileChooser setFileSelectionMode(JFileChooser FILES_AND_DIRECTORIES); // 設(shè)置文件選擇模式 此處為文件和目錄均可

if (fileChooser showSaveDialog(RunJava this) == JFileChooser APPROVE_OPTION) { // 彈出文件選擇器 并判斷是否點擊了打開按鈕

String fileName = fileChooser getSelectedFile() getAbsolutePath(); // 得到選擇文件或目錄的絕對路徑

System out println(fileName);

file = new File(fileName);

OutputData();

}

}else{

OutputData();

}

}

});

SaveAs = new JMenuItem( 另存為 );

SaveAs addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg ) {

JFileChooser fileChooser = new JFileChooser(); // 實例化文件選擇器

fileChooser setFileSelectionMode(JFileChooser FILES_AND_DIRECTORIES); // 設(shè)置文件選擇模式 此處為文件和目錄均可

if (fileChooser showSaveDialog(RunJava this) == JFileChooser APPROVE_OPTION) { // 彈出文件選擇器 并判斷是否點擊了打開按鈕

String fileName = fileChooser getSelectedFile() getAbsolutePath(); // 得到選擇文件或目錄的絕對路徑

file = new File(fileName);

OutputData();

}

}

});

Exit = new JMenuItem( 退出 );

Exit addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg ) {

int j=JOptionPane showConfirmDialog(RunJava this 真的要退出嗎? 退出 JOptionPane YES_OPTION JOptionPane QUESTION_MESSAGE);

if (j == JOptionPane YES_OPTION){

System exit( );

}

}

});

File add(Open);

File add(Save);

File add(SaveAs);

File add(Exit);

InsertMain = new JMenuItem( 新建 );

InsertMain addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg ) {

String str = public class test {\n

+ ?? public static void main(String[] args) {\n

+ ??? System out println(\ hello java\ );\n

+ ?? }\n + } ;

textArea_ setText(str);

textField setText(getName(textArea_ getText()));

}

});

MarkColor = new JMenuItem( 標注顏色 );

MarkColor addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent e) {

String str = public class test {\n

+ ?? public static void main(String[] args) {\n

+ ??? System out println(\ hello java\ );\n

+ ?? }\n + } ;

int a = str indexOf( class );

//???? System out println(a);

setDocs(str substring(a a+ ) Color RED true );

}

});

Edit add(InsertMain);

Edit add(MarkColor);

setJMenuBar(Part);

getContentPane() setLayout(null);

setBounds( );

setDefaultCloseOperation(JFrame EXIT_ON_CLOSE);

final JPanel panel = new JPanel();

panel setLayout(new BorderLayout());

panel setBounds( );

getContentPane() add(panel);

textArea_ = new JTextPane();

panel add(new JScrollPane(textArea_ ) BorderLayout CENTER);

final JPanel panel_ = new JPanel();

panel_ setLayout(new BorderLayout());

panel_ setBorder(new EtchedBorder(EtchedBorder LOWERED));

panel_ setForeground(Color BLUE);

panel_ setBounds( );

getContentPane() add(panel_ );

textArea = new JTextArea();

panel_ add(new JScrollPane(textArea) BorderLayout CENTER);

try {

UIManager setLookAndFeel( sun java swing plaf nimbus NimbusLookAndFeel );

} catch (Exception ex ) {

try {

UIManager setLookAndFeel( sun java swing plaf windows WindowsClassicLookAndFeel );

} catch (Exception ex ) {

UIManager setLookAndFeel( sun java swing plaf windows WindowsLookAndFeel );

}

}

SwingUtilities updateComponentTreeUI(this);

textField = new JTextField();

textField setToolTipText( 不填自動從Java代碼中提取類名 );

textField setBounds( );

getContentPane() add(textField);

final JLabel label = new JLabel();

label setText( 類名: );

label setBounds( );

getContentPane() add(label);

setResizable(false);// 屏蔽最大化按鈕

textField_ = new JTextField();

textField_ setBounds( );

textField_ setToolTipText( 可以和Java交互信息 );

getContentPane() add(textField_ );

final JButton button_ = new JButton();

button_ addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg ) {

cmd = textField_ getText();

}

});

button_ setText( CMD命令發(fā)送 );

button_ setBounds( );

getContentPane() add(button_ );

final JButton button_ = new JButton();

button_ addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg ) {

String name = textField getText();

if (name trim() length() == ) {

textField setText(getName(textArea_ getText()));

}

FileOut(textField getText() + java textArea_ getText());

File file = new File(url + textField getText() + class );

if (file exists()) {

file delete();

}

String exe = cmd ;

try {

pro = Runtime getRuntime() exec(exe);

if (InPutThread != null)InPutThread stop();

if (OutPutThread != null)InPutThread stop();

if (ErrorThread != null)InPutThread stop();

InPutThread = new Thread(new RunTimeInput());

OutPutThread = new Thread(new RunTimeOutput(new InputStreamReader(pro getInputStream())));

ErrorThread = new Thread(new RunTimeOutput(new InputStreamReader(pro getErrorStream())));

InPutThread start();

OutPutThread start();

ErrorThread start();

exec( javac + textField getText() + java );

Thread sleep( );

exec( java + textField getText() + );

} catch (Exception e) {

e printStackTrace();

}

}

});

button_ setText( 編譯/運行 );

button_ setBounds( );

getContentPane() add(button_ );

}

public void FileOut(String name String Content) {

File file = new File(url + name);

if (file exists())

file delete();

try {

file createNewFile();

FileOutputStream out = new FileOutputStream(file);

byte buf[] = Content getBytes();

out write(buf);

out flush();

out close();

} catch (Exception ex) {

ex printStackTrace();

}

}

public class RunTimeInput implements Runnable {

private BufferedWriter bw = null;

public void run() {

bw = new BufferedWriter(new OutputStreamWriter(pro getOutputStream()));

while (true) {

try {

if (cmd != null cmd length() ) {

bw write(cmd + \n\n );

bw flush();

cmd = null;

}

Thread sleep( );

} catch (Exception e) {

e printStackTrace();

}

}

}

}

public class RunTimeOutput implements Runnable {

InputStreamReader isr = null;

public RunTimeOutput(InputStreamReader is) {

isr = is;

}

private BufferedReader br = null;

public void run() {

br = new BufferedReader(isr);

while (true) {

try {

String s = br readLine();

if (s != null) {

textArea setText(textArea getText() + \n + s);

textArea setSelectionStart(textArea getText() length());

}

Thread sleep( );

} catch (Exception e) {

e printStackTrace();

}

}

}

}

public void exec(String Content) {

cmd = Content;

}

public String getName(String str) {

String name = ;

if (str indexOf( class ) != ) {

String[] s = str split( \\s+ );

for (int i = ; i s length; i++) {

if (s[i] equals( class )) {

if ((i + ) s length)

name = s[i + ];

int a = ;

if((a=name indexOf( { ))!= ){

name= name substring( a);

}

}

}

}

return name;

}

public void OutputData() {

try {

FileOutputStream out = new FileOutputStream(file);

byte buf[] = textArea_ getText() getBytes();

out write(buf);

out flush();

out close();

} catch (Exception e) {

e printStackTrace();

}

}

public void InputData() {

try {

FileInputStream in = new FileInputStream(file);

int a = (int)file length();

byte buf[] = new byte[a];

int len = in read(buf);

if (len == ){

System out println( 文件為空 );

}else{

textArea_ setText(new String(buf len));

}

} catch (Exception e) {

e printStackTrace();

}

}

/**

* @param str 內(nèi)容

* @param col 顏色

* @param bold 是否粗體

* @param fontSize 字體大小

*/

public void setDocs(String str Color col boolean bold int fontSize) {

SimpleAttributeSet attrSet = new SimpleAttributeSet();

StyleConstants setForeground(attrSet col);

// 顏色

if (bold == true) {

StyleConstants setBold(attrSet true);

}// 字體類型

StyleConstants setFontSize(attrSet fontSize);

// 字體大小

Document doc = textArea_ getDocument();

try {

doc insertString(doc getLength() str attrSet);

} catch (BadLocationException e) {

System out println( BadLocationException: + e);

}

}

}

lishixinzhi/Article/program/Java/hx/201311/26653


分享標題:ui的java代碼 ui java
本文URL:http://weahome.cn/article/ddspjse.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部