java 板


LINE

-------------------------------------------------------------------------------- http://www.neshkov.com/dj.html 用以上的decompiler將以下網頁的class檔反編譯 http://ngsir.netfirms.com/englishhtm/RLC.htm (有RLC.class和circuit.class和signal.class三個類別檔) 我有疑問的是,這三個檔被decompile出來後的source code例如RLC.java : -- <code> import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.util.EventObject; public class RLC extends Applet implements AdjustmentListener, ActionListener { public RLC() { } public void init() { setBackground(Color.white); setBounds(0, 0, 750, 500); mt = new MediaTracker(this); rcl = getImage(getCodeBase(), "rcl2.gif"); formula = getImage(getCodeBase(), "formula.gif"); formula2 = getImage(getCodeBase(), "formula2.gif"); formula3 = getImage(getCodeBase(), "formula3.gif"); mt.addImage(rcl, 1); mt.addImage(formula, 2); mt.addImage(formula2, 3); mt.addImage(formula3, 4); for(int i = 1; i <= 4; i++) { try { mt.waitForID; } catch(InterruptedException interruptedexception) { } if(mt.isErrorID) return; } amplitudeScrollbar = new Scrollbar(0, 8, 0, 2, 11); frequencyScrollbar = new Scrollbar(0, 346, 0, 100, 660); RScrollbar = new Scrollbar(0, 16, 0, 10, 100); CScrollbar = new Scrollbar(0, 260, 0, 50, 500); LScrollbar = new Scrollbar(0, 250, 0, 50, 500); pause = new Button("Pause"); step = new Button("Step"); amplitudeLabel = new Label("Vo = " + String.valueOf(amplitudeScrollbar.getValue()) + " V", 2); frequencyLabel = new Label("f = " + String.valueOf(0.10000000000000001D * (double)frequencyScrollbar.getValue()) + " Hz", 2); resistanceLabel = new Label("R = " + String.valueOf(0.10000000000000001D * (double)RScrollbar.getValue()) + " Ohm", 2); capacitanceLabel = new Label("C = " + String.valueOf(2 * CScrollbar.getValue()) + " microF", 2); inductanceLabel = new Label("L = " + String.valueOf((double)Math.round(2000D * (double)LScrollbar.getValue()) / 10000D) + " mH", 2); dummy = new Label(" "); offimg = createImage(getSize().width, getSize().height); offg = offimg.getGraphics(); circuit = new Circuit(offg, offimg, rcl, formula, formula2, formula3); circuit.Vo = amplitudeScrollbar.getValue(); circuit.omega = 0.62831999999999999D * (double)frequencyScrollbar.getValue(); circuit.R = 0.10000000000000001D * (double)RScrollbar.getValue(); circuit.C = 1.9999999999999999E-006D * (double)CScrollbar.getValue(); circuit.L = 0.00020000000000000001D * (double)LScrollbar.getValue(); amplitudeScrollbar.addAdjustmentListener(this); frequencyScrollbar.addAdjustmentListener(this); RScrollbar.addAdjustmentListener(this); CScrollbar.addAdjustmentListener(this); LScrollbar.addAdjustmentListener(this); pause.addActionListener(this); step.addActionListener(this); signal = new Signal(circuit); Panel panel = new Panel(); GBC = new GridBagConstraints(); GB = new GridBagLayout(); panel.setLayout(G; GBC.fill = 2; GBC.insets = new Insets(3, 3, 3, 3); GBC.ipadx = 10; GBC.gridx = 0; GBC.gridy = 0; GB.setConstraints(amplitudeLabel, GBC); panel.add(amplitudeLabel); GBC.ipadx = 30; GBC.gridx = 1; GB.setConstraints(amplitudeScrollbar, GBC); panel.add(amplitudeScrollbar); GBC.ipadx = 30; GBC.gridx = 2; GB.setConstraints(frequencyLabel, GBC); panel.add(frequencyLabel); GBC.ipadx = 30; GBC.gridx = 3; GB.setConstraints(frequencyScrollbar, GBC); panel.add(frequencyScrollbar); GBC.ipadx = 10; GBC.gridx = 4; GB.setConstraints(pause, GBC); panel.add(pause); GBC.gridx = 5; GB.setConstraints(step, GBC); panel.add(step); GBC.gridx = 0; GBC.gridy = 1; GB.setConstraints(resistanceLabel, GBC); panel.add(resistanceLabel); GBC.gridx = 1; GB.setConstraints(RScrollbar, GBC); panel.add(RScrollbar); GBC.gridx = 2; GB.setConstraints(capacitanceLabel, GBC); panel.add(capacitanceLabel); GBC.gridx = 3; GB.setConstraints(CScrollbar, GBC); panel.add(CScrollbar); GBC.gridx = 4; GB.setConstraints(inductanceLabel, GBC); panel.add(inductanceLabel); GBC.ipadx = 30; GBC.gridx = 5; GB.setConstraints(LScrollbar, GBC); panel.add(LScrollbar); setLayout(new BorderLayout()); add(circuit, "Center"); add(panel, "South"); circuit.calculate(); signal.start(); } public void actionPerformed(ActionEvent actionevent) { if(actionevent.getSource() == pause) { circuit.pause = !circuit.pause; if(circuit.pause) { pause.setLabel("Continue"); } else { pause.setLabel("Pause"); circuit.step = false; } } if(actionevent.getSource() == step) { circuit.step = true; circuit.pause = true; pause.setLabel("Continue"); } } public void adjustmentValueChanged(AdjustmentEvent adjustmentevent) { if(adjustmentevent.getSource() == amplitudeScrollbar) { amplitudeLabel.setText("Vo = " + String.valueOf(amplitudeScrollbar.getValue()) + " V"); circuit.Vo = amplitudeScrollbar.getValue(); } if(adjustmentevent.getSource() == frequencyScrollbar) { frequencyLabel.setText("f = " + String.valueOf((1.0D * (double)frequencyScrollbar.getValue()) / 10D) + " Hz"); double d = circuit.omega; circuit.omega = 0.62831999999999999D * (double)frequencyScrollbar.getValue(); circuit.t = (d * circuit.t) / circuit.omega; } if(adjustmentevent.getSource() == RScrollbar) { resistanceLabel.setText("R = " + String.valueOf((1.0D * (double)RScrollbar.getValue()) / 10D) + " Ohm"); circuit.R = 0.10000000000000001D * (double)RScrollbar.getValue(); } if(adjustmentevent.getSource() == CScrollbar) { capacitanceLabel.setText("C = " + String.valueOf(2 * CScrollbar.getValue()) + " microF"); circuit.C = 1.9999999999999999E-006D * (double)CScrollbar.getValue(); } if(adjustmentevent.getSource() == LScrollbar) { inductanceLabel.setText("L = " + String.valueOf((double)Math.round(2000D * (double)LScrollbar.getValue()) / 10000D) + " mH"); circuit.L = 0.00020000000000000001D * (double)LScrollbar.getValue(); } circuit.calculate(); circuit.repaint(); } int xx; int yy; Label amplitudeLabel; Label frequencyLabel; Label resistanceLabel; Label capacitanceLabel; Label inductanceLabel; Label dummy; Scrollbar amplitudeScrollbar; Scrollbar frequencyScrollbar; Scrollbar RScrollbar; Scrollbar CScrollbar; Scrollbar LScrollbar; Button pause; Button step; Circuit circuit; Signal signal; Graphics offg; Image offimg; Image rcl; Image formula; Image formula2; Image formula3; MediaTracker mt; GridBagLayout GB; GridBagConstraints GBC; } </code> -- 裡頭的circuit物件應該是屬於circuit類別檔的成員,但是一開始import部分卻沒有看到 ? 是不是這個decompiler有問題,還是某種javac允許編譯過程某些物件暫時未宣告繼承來 源? --



※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.44.115.138
2F:→ serveto:感謝樓上大大。我的問題是,單獨將RLC.java作編譯 09/23 09:26
3F:→ serveto:javac顯示circuit無效的type(因為沒有import) 09/23 09:27
4F:→ tkcn:我只是告訴你,那個檔案是存在的,至於為什麼不用寫 import 09/23 09:34
5F:→ tkcn:你可以再多想一下 09/23 09:36
6F:→ serveto:不好意思我是新手。現在事實上就是我用javac去執行 09/23 09:41
7F:→ serveto:作不出來 09/23 09:43
8F:推 nvidia:找個applet的文件來看 09/23 09:50







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:Tech_Job站內搜尋

TOP