DAFTAR LAMPIRAN. Source Code Java Aplikasi Keyword to Image Renamer Split

Similar documents
Answer on question #61311, Programming & Computer Science / Java

* To change this license header, choose License Headers in Project Properties.

* To change this license header, choose License Headers in Project Properties.

INSTITUTO POLITÉCNICO NACIONAL ESCUELA SUPERIOR DE CÓMPUTO

Lampiran A. SOURCE CODE PROGRAM

/** Creates new form NewJFrame */ public NewJFrame() { initcomponents(); initblogsearch(); //initializes Index List box }

COMP16121 Sample Code Lecture 1

SampleApp.java. Page 1

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

PART 23. Java GUI Advanced JList Component. more items.

17 GUI API: Container 18 Hello world with a GUI 19 GUI API: JLabel 20 GUI API: Container: add() 21 Hello world with a GUI 22 GUI API: JFrame: setdefau

I.1 Introduction Matisse GUI designer I.2 GroupLayout Basics Sequential and Parallel Arrangements sequential horizontal orientation

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Travel Agency. Khateeb Engineering Classes. Mini Project. Khateeb Engineering Classes: / Technology to be used

Goals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords

Java Programming Summer 2008 LAB. Thursday 8/21/2008

APPENDIX. public void cekroot() { System.out.println("nilai root : "+root.data); }

AP CS Unit 11: Graphics and Events

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Graphical User Interface

Example: Building a Java GUI

Example: Building a Java GUI

// autor igre Ivan Programerska sekcija package mine;

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Izpack installer guide

AppBisect > PrBisect > class Functie. AppBisect > PrBisect > class Punct. public class Functie { double x(double t) { return t;

Systems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid

Graphical User Interfaces in Java - SWING

!"# $ %&# %####' #&() % # # # #&* # ## +, # -

1 Using the NetBeans IDE

/* Write a Program implementing GUI based Calculator using Swing */

Hanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)

GUI (Graphic User Interface) Programming. Part 2 (Chapter 8) Chapter Goals. Events, Event Sources, and Event Listeners. Listeners

PART 22. Java GUI Library SWT GUI Library SWING GUI Library Swing First Program

JAVA CODE JAVA CODE: BINOMIAL TREES OPTION PRICING BINOMIALTREE CLASS PAGE 1

Swing - JTextField. Adding a text field to the main window (with tooltips and all)

More about GUIs GEEN163

Based on slides by Prof. Burton Ma

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

JAVA NOTES GRAPHICAL USER INTERFACES

PIC 20A GUI with swing

Object-Oriented Software Engineering Re-exam, 2012 (Also Object-Oriented Analysis, Design and Programming, Re-exam, 2012)

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

AnimatedImage.java. Page 1

Dr. Hikmat A. M. AbdelJaber

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

CSCI 201L Midterm Written Summer % of course grade

Section Basic graphics

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver

Appendix I: Software Coding

jlabel14 = new javax.swing.jlabel(); jlabel15 = new javax.swing.jlabel(); jlabel16 = new javax.swing.jlabel(); jlabel17 = new javax.swing.

Commands. Written commands can be reused, cataloged, etc. Sometimes they also contain "undo" commands, too.

Chapter 13 Lab Advanced GUI Applications

PlaniSphere. Creating a plug-in for PlaniSphere.

Datenbank-Praktikum. Universität zu Lübeck Sommersemester 2006 Lecture: Swing. Ho Ngoc Duc 1

GUI Applications. Let s start with a simple Swing application in Java, and then we will look at the same application in Jython. See Listing 16-1.

CHAPTER 8 INFERENCE. The concept of Inference would be explained in the following chapter, as the CTBN

Building Java Programs Bonus Slides

Graphical interfaces & event-driven programming

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

class BankFilter implements Filter { public boolean accept(object x) { BankAccount ba = (BankAccount) x; return ba.getbalance() > 1000; } }

Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing

JRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();

Swing - JLabel. Adding a text (and HTML) labels to a GUI

Our first program is a simple calculator, which will carry out the arithmetic operations of adding, subtracting, multiplying and dividing numbers.

Chapter 13 Lab Advanced GUI Applications Lab Objectives. Introduction. Task #1 Creating a Menu with Submenus

Role-Coll Role Based Collaboration Software

Part I: Learn Common Graphics Components

Graphical User Interfaces in Java

Overview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008

Workbook 7. Remember to check the course website regularly for announcements and errata:

COMP Assignment #10 (Due: Monday, March 11:30pm)

CMP-326 Exam 2 Spring 2018 Solutions Question 1. Version 1. Version 2

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Multimedia Programming

CSCI 201L Midterm Written SOLUTION Summer % of course grade

import java.applet.applet; import java.applet.audioclip; import java.net.url; public class Vjesala2 {

package As7BattleShip;

CMP 326 Midterm Fall 2015

Studying software design patterns is an effective way to learn from the experience of others

Midterm assessment - MAKEUP Fall 2010

Java GUI Design: the Basics

CS 251 Intermediate Programming GUIs: Event Listeners

CMP 326 Final Spring There is a blank page at the end of the exam if you need more room to answer a question.

RAIK 183H Examination 2 Solution. November 10, 2014

COSC 123 Computer Creativity. Graphics and Events. Dr. Ramon Lawrence University of British Columbia Okanagan

69 Section 7: Example:Single times table with exception catching 70 Aim 74 Single times table with exception catching

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

CS 251 Intermediate Programming GUIs: Components and Layout

Property Editors and Customizers. COMP434 Software Design. Property Editors. Property Editors and. Property Editors.

COMP16121 Notes on Mock Exam Questions

CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2015

CS108, Stanford Handout #33. Sockets

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

Projet Compilation Analyseur Lexical En Java

Points Missed on Page page 1 of 8

Chapter 9 Designing Graphical User Interfaces (GUIs)

Transcription:

DAFTAR LAMPIRAN Source Code Java Aplikasi Keyword to Image Renamer Split Source Code Menu Utama package spin_text; import java.awt.color; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.grouplayout; import javax.swing.grouplayout.alignment; import javax.swing.grouplayout.parallelgroup; import javax.swing.grouplayout.sequentialgroup; import javax.swing.jbutton; import javax.swing.jpanel; import javax.swing.jscrollpane; import javax.swing.jtextarea; import javax.swing.layoutstyle.componentplacement; public class MainMenu extends JPanel private JTextArea hasil; private JButton jbutton1; private JScrollPane jscrollpane1; private JScrollPane jscrollpane2; private JTextArea text; public MainMenu() initcomponents(); private void initcomponents() this.jscrollpane1 = new JScrollPane(); this.text = new JTextArea();

this.jbutton1 = new JButton(); this.jscrollpane2 = new JScrollPane(); this.hasil = new JTextArea(); setbackground(new Color(255, 204, 204)); this.text.setcolumns(20); this.text.setrows(5); this.jscrollpane1.setviewportview(this.text); this.jbutton1.settext("jbutton1"); this.jbutton1.addactionlistener(new ActionListener() public void actionperformed(actionevent evt) MainMenu.this.jButton1ActionPerformed(evt); ); this.hasil.setcolumns(20); this.hasil.setrows(5); this.jscrollpane2.setviewportview(this.hasil); GroupLayout layout = new GroupLayout(this); setlayout(layout); layout.sethorizontalgroup(layout.createparallelgroup(grouplayout.alignment.leading).addgroup(layout.createsequentialgroup().addcontainergap().addcomponent(this.jscrollpane1, -2, 260, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 110, 32767).addComponent(this.jButton1).addGap(89, 89, 89).addComponent(this.jScrollPane2, -2, 268, -2))); layout.setverticalgroup(layout.createparallelgroup(grouplayout.alignment.leading).addgroup(grouplayout.alignment.trailing, layout.createsequentialgroup().addcontainergap().addgroup(layout.createparallelgroup(grouplayout.alignment.t RAILING).addComponent(this.jScrollPane2, -1, 465, 32767).addComponent(this.jScrollPane1)

.addgroup(layout.createsequentialgroup().addgap(0, 0, 32767).addComponent(this.jButton1))).addGap(20, 20, 20))); private void jbutton1actionperformed(actionevent evt) String text_source = this.text.gettext(); String[] data = text_source.split("\r \n"); for (String t : data) this.hasil.append(t); this.hasil.append("\r \n"); Source Code Input Folder package spin_text; import java.awt.color; import java.awt.container; import java.awt.cursor; import java.awt.eventqueue; import java.awt.font; import java.awt.toolkit; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.io.file; import java.io.printstream; import java.util.random; import java.util.logging.level; import java.util.logging.logger; import javax.swing.grouplayout; import javax.swing.grouplayout.alignment; import javax.swing.grouplayout.parallelgroup; import javax.swing.grouplayout.sequentialgroup; import javax.swing.jbutton; import javax.swing.jfilechooser; import javax.swing.jframe; import javax.swing.jlabel;

import javax.swing.jscrollpane; import javax.swing.jtextarea; import javax.swing.jtextfield; import javax.swing.layoutstyle.componentplacement; import javax.swing.uimanager; import javax.swing.uimanager.lookandfeelinfo; import javax.swing.unsupportedlookandfeelexception; public class Menu extends JFrame private JTextArea hasil; private JButton jbutton1; private JLabel jlabel1; private JLabel jlabel2; private JLabel jlabel3; private JLabel jlabel4; private JLabel jlabel5; private JScrollPane jscrollpane1; private JScrollPane jscrollpane2; private JTextField max; private JTextField min; private JTextArea text; public Menu() initcomponents(); seticon(); private void initcomponents() this.jscrollpane1 = new JScrollPane(); this.text = new JTextArea(); this.jscrollpane2 = new JScrollPane(); this.hasil = new JTextArea(); this.jbutton1 = new JButton(); this.min = new JTextField(); this.max = new JTextField(); this.jlabel1 = new JLabel(); this.jlabel2 = new JLabel(); this.jlabel3 = new JLabel(); this.jlabel4 = new JLabel(); this.jlabel5 = new JLabel(); setdefaultcloseoperation(3);

settitle("keyword TO IMAGE NAME SPLIT"); setbackground(new Color(255, 102, 102)); setcursor(new Cursor(0)); setforeground(new Color(255, 102, 102)); setlocation(location()); setresizable(false); this.text.setcolumns(20); this.text.setrows(5); this.jscrollpane1.setviewportview(this.text); this.hasil.setcolumns(20); this.hasil.setrows(5); this.jscrollpane2.setviewportview(this.hasil); this.jbutton1.setfont(new Font("Calibri Light", 1, 18)); this.jbutton1.settext("spin NOW"); this.jbutton1.addactionlistener(new ActionListener() public void actionperformed(actionevent evt) Menu.this.jButton1ActionPerformed(evt); ); this.min.sethorizontalalignment(0); this.min.settext("7"); this.max.sethorizontalalignment(0); this.max.settext("15"); this.max.addactionlistener(new ActionListener() public void actionperformed(actionevent evt) Menu.this.maxActionPerformed(evt); ); this.jlabel1.setfont(new Font("Calibri Light", 1, 14)); this.jlabel1.sethorizontalalignment(0); this.jlabel1.settext("minimum Keyword"); this.jlabel2.setfont(new Font("Calibri Light", 1, 14)); this.jlabel2.sethorizontalalignment(0); this.jlabel2.settext("maximum Keyword"); this.jlabel3.setfont(new Font("Tahoma", 2, 10)); this.jlabel3.settext("keyword To Image Name v.1.05");

this.jlabel4.setfont(new Font("Tahoma", 2, 10)); this.jlabel4.settext("*)fix dash before extention"); this.jlabel5.setfont(new Font("Tahoma", 3, 11)); this.jlabel5.settext("hgnky@izamedia14"); GroupLayout layout = new GroupLayout(getContentPane()); getcontentpane().setlayout(layout); layout.sethorizontalgroup(layout.createparallelgroup(grouplayout.alignment.leading).addgroup(layout.createsequentialgroup().addcontainergap().addgroup(layout.createparallelgroup(grouplayout.alignment.l EADING).addGroup(layout.createSequentialGroup().addComponent(this.jScrollPane1, -2, 225, -2).addGap(21, 21, 21).addGroup(layout.createParallelGroup(GroupLayout.Alignment.T RAILING, false).addcomponent(this.jlabel4).addcomponent(this.jlabel1, GroupLayout.Alignment.LEADING, -1, -1, 32767).addComponent(this.jLabel2, GroupLayout.Alignment.LEADING, -1, -1, 32767).addComponent(this.max, GroupLayout.Alignment.LEADING).addComponent(this.min, GroupLayout.Alignment.LEADING).addComponent(this.jButton1, GroupLayout.Alignment.LEADING, -1, -1, 32767)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 34, 32767).addComponent(this.jScrollPane2, -2, 224, -2).addGap(0, 0, 32767)).addGroup(GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcomponent(this.jlabel5, -2, 124, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, -1, 32767).addComponent(this.jLabel3))).addContainerGap())); layout.setverticalgroup(layout

.createparallelgroup(grouplayout.alignment.leading).addgroup(grouplayout.alignment.trailing, layout.createsequentialgroup().addcontainergap().addgroup(layout.createparallelgroup(grouplayout.alignment.t RAILING).addGroup(layout.createSequentialGroup().addComponent(this.jLabel1).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.min, -2, -1, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.jLabel2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.max, -2, -1, -2).addGap(18, 18, 18).addComponent(this.jButton1).addGap(18, 18, 18).addComponent(this.jLabel4).addGap(168, 168, 168)).addGroup(layout.createParallelGroup(GroupLayout.Alignment.L EADING, false).addcomponent(this.jscrollpane1, -1, 353, 32767).addComponent(this.jScrollPane2))).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.B ASELINE).addComponent(this.jLabel5).addComponent(this.jLabel3)).addGap(0, 11, 32767))); pack(); setlocationrelativeto(null); private void jbutton1actionperformed(actionevent evt) JFileChooser fc = new JFileChooser(); fc.setfileselectionmode(1); int val = fc.showopendialog(this);

String path = fc.getselectedfile().getpath(); File folder = new File(path); File[] listfile = folder.listfiles(); for (int ks = 0; ks < listfile.length; ks++) System.out.println(listFile[ks]); String text_source = this.text.gettext(); String[] data = text_source.split("\n"); System.out.println(data.length); int jumlah_gambar = listfile.length; int jumlah_kata_max = Integer.parseInt(this.max.getText()); int jumlah_kata_min = Integer.parseInt(this.min.getText()); String kot = ""; for (int i = 0; i < jumlah_gambar; i++) Random r = new Random(); int jumlah_kata = r.nextint(jumlah_kata_max - jumlah_kata_min) + jumlah_kata_min; String temp_hasil = ""; for (int x = 0; x <= jumlah_kata; x++) Random t = new Random(); int index_kata = t.nextint(data.length - 0) + 0; String temp = data[index_kata]; if (temp_hasil.contains(temp)) x--; else temp_hasil = temp_hasil + " " + temp; if (!cek_nama(temp_hasil)) this.hasil.append(temp_hasil); this.hasil.append("\r\n"); else i--; String nama_baru = path + "/gh/" + temp_hasil + ".jpg";

File baru = new File(nama_baru); if (listfile[i].renameto(baru)) System.out.println("Good"); else System.out.println("gagal ganti nama" + listfile[i]); private void maxactionperformed(actionevent evt) public boolean cek_nama(string nama) boolean r = true; String text_source = this.text.gettext(); String[] data = text_source.split("\n"); for (int i = 0; i < data.length; i++) if (nama.equals(data[i])) return true; return false; public static void main(string[] args) try for (UIManager.LookAndFeelInfo info : ) if ("Nimbus".equals(info.getName())) UIManager.setLookAndFeel(info.getClassName()); break; catch (ClassNotFoundException ex) Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); catch (InstantiationException ex)

Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); catch (IllegalAccessException ex) Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); catch (UnsupportedLookAndFeelException ex) Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); EventQueue.invokeLater(new Runnable() public void run() new Menu().setVisible(true); ); private void seticon() seticonimage(toolkit.getdefaulttoolkit().getimage(getclass().getresource("icon.png")));