EG Information
Training Missions
Knowledge Bank
Pimp Us Out!
Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.
|
| |
Affiliates
|
|
Enigma Group's Code Bank
MyIDEBy: darkside - Date Submitted: 2010-03-16 23:31:36 import java.io.BufferedReader; import java.io.File; import java.io.FileFilter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; /* * Face.java * * Created on Mar 7, 2010, 12:46:03 AM */ /** * My Integrated Development Environment tested on SLAX and Windows XP * * @author The Son of Man * @version 1.0.0.1 */ public class Face extends javax. swing. JFrame { /** Creates new form Face */ public String curFile, gcc = "/usr/bin/gcc", cc = "/usr/bin/cc", product, _os, titleBar, defaultTitle ; public boolean cFile, isLinux; public Face() { initComponents(); this._os = System. getProperty(nameOS ); this.defaultTitle = "MyIDE" + "@" + this._os + ": "; this.titleBar = this.defaultTitle; setTitle(this.titleBar); if (this._os.equals("Linux")) { this.isLinux = true; } else { this.gccField.setText("specify"); this.parameterField.setText("specify"); this.isLinux = false; } this.setResizable(false); this.cFile = false; this.curFile = null; this.product = null; } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { contentPanel = new javax. swing. JPanel(); menuPanel = new javax. swing. JPanel(); gccLabel = new javax. swing. JLabel(); paramLabel = new javax. swing. JLabel(); fileNameLabel = new javax. swing. JLabel(); l_label = new javax. swing. JLabel(); lCount = new javax. swing. JLabel(); pathLabel = new javax. swing. JLabel(); shButton = new javax. swing. JButton(); fileMenu = new javax. swing. JMenu(); fileSeparator = new javax. swing. JPopupMenu. Separator(); codeMenu = new javax. swing. JMenu(); compileMenuItem = new javax. swing. JMenuItem(); aboutMenu = new javax. swing. JMenu(); setTitle("MyIDE"); setCursor (new java. awt. Cursor(java. awt. Cursor. DEFAULT_CURSOR)); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); contentPanel. setBorder(new javax. swing. border. MatteBorder(null)); menuPanel. setBorder(javax. swing. BorderFactory. createEtchedBorder()); parameterField.setText("-Wall -o"); parameterField.setToolTipText("Parameters for the compiler. Default: -Wall -o"); fileNameField.setText("myapp"); fileNameField.setToolTipText("The filename to save the file as."); gccField.setText("/usr/bin/g++"); gccField.setToolTipText("The location of the gcc, g++, or cc compiler in your system."); gccLabel.setText("gcc location"); paramLabel.setText("parameters"); fileNameLabel.setText("filename"); l_label.setText("line count:"); lCount.setText("0"); pathLabel.setText("program path"); pathField.setText("specify"); pathField.setToolTipText("The path to save the file to."); shButton.setText("shell"); shButton.setToolTipText("Opens a shell."); public void actionPerformed (java. awt. event. ActionEvent evt ) { shButtonActionPerformed(evt); } }); javax.swing.GroupLayout menuPanelLayout = new javax.swing.GroupLayout(menuPanel); menuPanel.setLayout(menuPanelLayout); menuPanelLayout.setHorizontalGroup( menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(menuPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(gccLabel) .addComponent(gccField, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(menuPanelLayout.createSequentialGroup() .addComponent(l_label) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lCount))) . addPreferredGap(javax. swing. LayoutStyle. ComponentPlacement. RELATED, javax. swing. GroupLayout. DEFAULT_SIZE, Short. MAX_VALUE) .addGroup(menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) . addComponent(parameterField, javax. swing. GroupLayout. Alignment. TRAILING, javax. swing. GroupLayout. DEFAULT_SIZE, 112, Short. MAX_VALUE) .addComponent(paramLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(fileNameLabel) . addComponent(fileNameField, javax. swing. GroupLayout. DEFAULT_SIZE, 112, Short. MAX_VALUE)) .addGap(12, 12, 12) .addGroup(menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(menuPanelLayout.createSequentialGroup() . addComponent(pathField, javax. swing. GroupLayout. DEFAULT_SIZE, 130, Short. MAX_VALUE) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, menuPanelLayout.createSequentialGroup() . addComponent(shButton, javax. swing. GroupLayout. DEFAULT_SIZE, 130, Short. MAX_VALUE) .addContainerGap()) .addGroup(menuPanelLayout.createSequentialGroup() .addComponent(pathLabel) .addGap(27, 27, 27)))) ); menuPanelLayout.setVerticalGroup( menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(menuPanelLayout.createSequentialGroup() .addGroup(menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(gccLabel) .addComponent(paramLabel) .addComponent(fileNameLabel) .addComponent(pathLabel)) .addGap(3, 3, 3) .addGroup(menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(gccField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(parameterField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pathField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(menuPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_label) .addComponent(lCount) .addComponent(shButton, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)) . addContainerGap(javax. swing. GroupLayout. DEFAULT_SIZE, Short. MAX_VALUE)) ); _textArea.setColumns(20); _textArea.setRows(5); _textArea. addCaretListener(new javax. swing. event. CaretListener() { public void caretUpdate (javax. swing. event. CaretEvent evt ) { _textAreaCaretUpdate(evt); } }); scrollPane.setViewportView(_textArea); javax.swing.GroupLayout contentPanelLayout = new javax.swing.GroupLayout(contentPanel); contentPanel.setLayout(contentPanelLayout); contentPanelLayout.setHorizontalGroup( contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, contentPanelLayout.createSequentialGroup() . addContainerGap(javax. swing. GroupLayout. DEFAULT_SIZE, Short. MAX_VALUE) .addComponent(menuPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) . addComponent(scrollPane, javax. swing. GroupLayout. DEFAULT_SIZE, 548, Short. MAX_VALUE) ); contentPanelLayout.setVerticalGroup( contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, contentPanelLayout.createSequentialGroup() . addComponent(scrollPane, javax. swing. GroupLayout. DEFAULT_SIZE, 510, Short. MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(menuPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); getContentPane().add(contentPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 550, 610)); fileMenu.setText("File"); fileMenu.setToolTipText(""); openMenuItem.setText("Open a file"); openMenuItem.setToolTipText("Open an already written file for editing purposes, etc."); public void actionPerformed (java. awt. event. ActionEvent evt ) { openMenuItemActionPerformed(evt); } }); fileMenu.add(openMenuItem); saveMenuItem.setText("Save current file"); saveMenuItem.setToolTipText("Save this file for future usage, etc."); public void actionPerformed (java. awt. event. ActionEvent evt ) { saveMenuItemActionPerformed(evt); } }); fileMenu.add(saveMenuItem); closeMenuItem.setText("Close this file"); closeMenuItem.setToolTipText("Close this file to begin coding something else, etc."); public void actionPerformed (java. awt. event. ActionEvent evt ) { closeMenuItemActionPerformed(evt); } }); fileMenu.add(closeMenuItem); fileMenu.add(fileSeparator); exitMenuItem.setText("Exit"); exitMenuItem.setToolTipText("This will close the application."); public void actionPerformed (java. awt. event. ActionEvent evt ) { exitMenuItemActionPerformed(evt); } }); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); codeMenu.setText("Code"); codeMenu.setToolTipText(""); compileMenuItem.setText("Compile"); compileMenuItem.setToolTipText("Compiles the file. Be sure to check it out with the shell button."); compileMenuItem. addActionListener(new java. awt. event. ActionListener() { public void actionPerformed (java. awt. event. ActionEvent evt ) { compileMenuItemActionPerformed(evt); } }); codeMenu.add(compileMenuItem); cnrMenuItem.setText("Compile & Run"); cnrMenuItem.setToolTipText("Compiles the file and executes it afterward."); public void actionPerformed (java. awt. event. ActionEvent evt ) { cnrMenuItemActionPerformed(evt); } }); codeMenu.add(cnrMenuItem); menuBar.add(codeMenu); aboutMenu.setText("About"); aboutMenu.setToolTipText(""); myIDEMenuItem.setText("MyIDE"); myIDEMenuItem.setToolTipText("Usage/Author information."); public void actionPerformed (java. awt. event. ActionEvent evt ) { myIDEMenuItemActionPerformed(evt); } }); aboutMenu.add(myIDEMenuItem); menuBar.add(aboutMenu); setJMenuBar(menuBar); pack(); }// </editor-fold>//GEN-END:initComponents private void openMenuItemActionPerformed (java. awt. event. ActionEvent evt ) {//GEN-FIRST:event_openMenuItemActionPerformed try { if (this.cFile == false) { int returnval = this.fChooser.showOpenDialog(this); File file = this. fChooser. getSelectedFile(); try { boolean eof = false; while (!eof) { String line = fData. readLine(); if (line != null) lines += (line+"\r\n"); else eof = true; } fData.close(); String _message = "Could not open the file.", _title = "Error"; } this.cFile = true; this.curFile = file.getPath(); this.setTitleBar(this.curFile); this._textArea.setText(lines); } } else { String _message = "Please (save and) close the current file first.", _title = "Error"; } String _message = "Please (save and) close the current file first.", _title = "Error"; } }//GEN-LAST:event_openMenuItemActionPerformed private void saveMenuItemActionPerformed (java. awt. event. ActionEvent evt ) {//GEN-FIRST:event_saveMenuItemActionPerformed int returnval = this.fChooser.showSaveDialog(this); File file = this. fChooser. getSelectedFile(); this._textArea.append("\n"); // for gcc purposes try { String fData = this._textArea. getText(); this.curFile = file.getPath(); out.write(fData); out.close(); String _message = "The file could not be saved.", _title = "Error"; } } this.cFile = true; this.setTitleBar(this.curFile); }//GEN-LAST:event_saveMenuItemActionPerformed private void closeMenuItemActionPerformed (java. awt. event. ActionEvent evt ) {//GEN-FIRST:event_closeMenuItemActionPerformed try { if (this.cFile == true) { this.curFile.equals(null); this.setTitleBar(""); this.cFile = false; this._textArea.setText(""); } else if (!(this._textArea.getText().isEmpty())) { this._textArea.setText(""); } else { String _message = "No text to clear.", _title = "Error"; } String _message = "No text to clear.", _title = "Error"; } }//GEN-LAST:event_closeMenuItemActionPerformed private void setTitleBar (String _curFile ) { this.titleBar = this.defaultTitle + _curFile; setTitle(this.titleBar); } private void exitMenuItemActionPerformed (java. awt. event. ActionEvent evt ) {//GEN-FIRST:event_exitMenuItemActionPerformed this.dispose(); }//GEN-LAST:event_exitMenuItemActionPerformed private void compileMenuItemActionPerformed (java. awt. event. ActionEvent evt ) {//GEN-FIRST:event_compileMenuItemActionPerformed try { if (this.cFile == true) { if (!(this.gccField.getText().equals(null)) && !(this.parameterField.getText().equals(null)) && !(this.fileNameField.getText().equals(null)) && !(this.pathField.getText().equals(null))) { try { String cmd = this. gccField. getText() + " " + this.parameterField.getText() + " " + this.pathField.getText() + this.fileNameField.getText() + " " + this.curFile; String _message = "Could not compile.", _title = "Error"; } } else { String _message = "Fill out each text field first.", _title = "Error"; } } else { String _message = "Save the file first or choose a file.", _title = "Error"; } String _message = "Fill out each text field first.", _title = "Error"; } }//GEN-LAST:event_compileMenuItemActionPerformed private void cnrMenuItemActionPerformed (java. awt. event. ActionEvent evt ) {//GEN-FIRST:event_cnrMenuItemActionPerformed try { if (this.cFile == true) { if (!(this.gccField.getText().equals(null)) && !(this.parameterField.getText().equals(null)) && !(this.fileNameField.getText().equals(null)) && !(this.pathField.getText().equals(null))) { try { String cmd = this. gccField. getText() + " " + this.parameterField.getText() + " " + this.pathField.getText() + this.fileNameField.getText() + " " + this.curFile; String _message = "Could not compile.", _title = "Error"; } this.product.equals(this.fileNameField.getText()); this.pathField.setText(this.product); String sh_cmd = "/usr/bin/xterm" + " " + this. pathField. getText() + this. fileNameField. getText(); try { String _message = "Could not execute the compilation.\n\n" + exc. getMessage(), _title = "Error"; } } else { String _message = "Fill out each text field first.", _title = "Error"; } } else { String _message = "Save the file first or choose a file.", _title = "Error"; } String _message = "Fill out each text field first.", _title = "Error"; } }//GEN-LAST:event_cnrMenuItemActionPerformed private void myIDEMenuItemActionPerformed (java. awt. event. ActionEvent evt ) {//GEN-FIRST:event_myIDEMenuItemActionPerformed String _message = "I wrote this program because I seriously couldn't find a C++ IDE for Linux.\n" + "MyIDE is a simple, platform-independent application written with Java Technology.\n" + "\nInstructions:\n" + "Specify location of gcc\n" + "Specify gcc parameters\n" + "Specify compilation file name\n" + "Specify path to save file to" + "\n\nAuthor: The Son of Man" + "\nEMail: 6461726B73696465@gmail.com", _title = "About MyIDE"; }//GEN-LAST:event_myIDEMenuItemActionPerformed private void shButtonActionPerformed (java. awt. event. ActionEvent evt ) {//GEN-FIRST:event_shButtonActionPerformed if (this.isLinux == true) { String cmd = "/usr/bin/xterm"; try { p = Runtime. getRuntime(). exec(cmd, null, wd ); String _message = "Couldn't open bash.", _title = "Error"; } } else if (this.isLinux == false) { String cmd = "C:\\WINDOWS\\system32\\cmd.exe"; try { p = Runtime. getRuntime(). exec(cmd ); String _message = "Couldn't open command prompt.", _title = "Error"; } } else { String _message = "You must manually open your shell.", _title = "Error"; } }//GEN-LAST:event_shButtonActionPerformed private void _textAreaCaretUpdate (javax. swing. event. CaretEvent evt ) {//GEN-FIRST:event__textAreaCaretUpdate int count = this._textArea.getLineCount(); this. lCount. setText(String. valueOf(count )); }//GEN-LAST:event__textAreaCaretUpdate /** * @param args the command line arguments */ public static void main (String args []) { public void run() { new Face().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax. swing. JMenu aboutMenu ; private javax. swing. JMenu codeMenu ; private javax. swing. JMenuItem compileMenuItem ; private javax. swing. JPanel contentPanel ; private javax. swing. JMenu fileMenu ; private javax. swing. JLabel fileNameLabel ; private javax. swing. JPopupMenu. Separator fileSeparator ; private javax. swing. JLabel gccLabel ; private javax. swing. JLabel lCount ; private javax. swing. JLabel l_label ; private javax. swing. JPanel menuPanel ; private javax. swing. JLabel paramLabel ; private javax. swing. JLabel pathLabel ; private javax. swing. JButton shButton ; // End of variables declaration//GEN-END:variables }
|
| Return to
java category list |
|
|
Who Visited EnigmaGroup Today?
1504 Guests, 297 Users (189 Spiders)
mongrel88, Taireegaddita, Taicadine, theanonymous21, alexelixir, c_a13, Abhinav2107, hizImmoli, scifics, slchill, spartanvedicrishi, KELATALFTUS, kynapse, Tonyui, Hackpad, Epilioptiop, VireekadiaFap, Mamorite, IodindDog, brunoriversyhn, Effomeidonize, ReottphoffBom, arktek, burgeoningneophyte, TradaGreant, SlayingDragons, Waldlyeps, Arsenal, CJ_Omaha, CreedoFiegree, Ryuske, thethird3y3, todayadvila, pwnpwnlolz, NeetaexomYgom, ookami-namikaze, dot_Cipher, Unotohumsmush, SaubymorRoyab, bivaEmilltite, loltyg, Ausome1, Rik, hrangel, cyber-guard, Meonkzt, mori, 31415926, optioniLele, intorerse, FlifobbyFloks, Ios, saraf, Røgue, cossyDrybrich, IvanDimitriev, havisham, KIKNWING, fitz, fleeloCycle, hackboy302, strudels, CootoDorbeeft, gymnediny, hustleman9tv, comando300, Ysri13, thatoneguy, Paran0id, whoami, Pitanteerve, r0z4, Reapon, cls777, myfabregas, Afrika, suetekh, somebody777, floontiny, Frudopvia, jasonbourne, zombiehack640, CloverCipher, spoosh, Fraubbova, rulebreaker, dncjor, obencefoozy, Fintyoptots, viRuleNt, NipPaineHainy, TheHarrisonW, Jamesgo, TheGanjator, psychomarine, 1421carter, tingle65, claudius, Feld Grau, Partisan, Gunslinger, gydeqqzpn, yshiau, Zaccarato, chromoSone, priovasashCor, ellisp, GothicLogic, keetone, M0rdak, UsedDeteKef, nhorton, archestraty, HatriteBeft, JC06dc5, alpha1, spg, dark_void, wakazi, mtroscheck, TheCheeseDemon, ach.n30, sahariar, hervelegeraf, Psiber_Syn, hackaday, Mod777, neompenly, pollolololo, SnoopSky, Cigmimifs, DrOptix, ProloG-Shaman, unicornrainbow, cheapnikeshoxog, bobsters, foofthoorgo, polemarchos, avacraft, spencerwilliams23, lotato, ryanjcrook, dollerolf, robintenboden, rospark, WexEmbet, BeefSupreme, Hessesian, whydoyoulook, cdpirate, DnA-Ender, CaNcEr, zheincnoob, Vengeance987, justforfun363, RawTeefecycle, Squissesk, aVoid, SaMTHG, neodude, Marion1p, Ops, ddxc, BlAd373, Klosse, khamhou, samsatHD80, PauffPubadvic, AnnaNoult, SexyCreerve, newb1, robster1977, Blizer, Dudleypagrove, Mr_KaLiMaN, FirewallPenetrator, GMo, Seasharp, mrchicken1, Zaxem, N4g4c3N, MaxMeier, Ian, sander.ashwin, Predatorc, lonely.connection, ElEnfermado, wavyd, dirkdanblue, cve916, drag0n, kalak55, a1los, jell0, Exclaw, veceattainc, Muselele, Mr Pacifist, stylish007, zach, litbk, closednetwork99, soroimmuror, memoryshot, PlaneReaction, Wamemanytex38, DieAble, d0seN_36b, jeremy.whitson, lol, nefeolnb, Noticon, statix, anandoump, RomeoG, advilapyday, snorapa, Gkjt, autotuneuser, beanulpinee, 2142, kiklopas, door51, Pizza, deepakkumar, makler2004, M4rcy, Xargos, bdkoenig, Blavatsky, m4f10, Huasca, itsme, xu_lain, Nikhil, ChewBigRed, samxoxo, incicaMaidits, toudioria, Chidokage, Jigoku, cesecyclelm, schn1ffl3r, sam20000, learning, kentora, San Marino, Nightraven, zanydouner, FrofErrodslot, FatalEror, wheaties, akki, AlexDiru, unclejos666, override101, blink_212, uncowstientee, lilkpoigogs, Innonaenupt607, Killshot, ZheIncKnight, ActictGlync, acarseflalk, ___, trashsporn, Memartent, Zoorsornaks, z3z3, heyhey123, Ghajnm, usaliaPels, Ordeptpen, pelly, quellense, Szuba, nmobin27, lamb, x1rt4m, ToutousaRulty, vipervince2002, mannavard1611, BinaryShinigami, Duchdund, afgnumgt, Anatissa, greatg, darkfire1515, bennyblanco5000, Mmmett50, ToryLogsEsoff, impalwinona, Kelsfednege, ensubbrut, ant0601, Alpha0mega, pbarwim |
| |
|
|
|
|
|