This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package akar; | |
import java.util.Scanner; | |
public class Segitiga { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
int a, b, c; | |
System.out.print("Masukan bilangan A:"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package akar; | |
import java.util.Scanner; | |
public class inputtigabilangan { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
int x, y, z, a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package akar; | |
import java.util.Scanner; | |
public class Cara3 { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
//k = detik | |
Scanner masuk = new Scanner(System.in); | |
int j,m,d,k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package akar; | |
import java.util.Scanner; | |
public class Cara2 { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
//detik | |
Scanner masuk = new Scanner(System.in); | |
int j,x,y,m,z,d,k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package akar; | |
import java.util.Scanner; | |
public class Cara1 { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
//detik | |
Scanner masuk = new Scanner(System.in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void tampilTabel() { | |
if(lblId.getText().contains("E")){ | |
try { | |
hapusIsiTabel(); | |
Connection conE1 = (Connection) Koneksi.getKoneksi(); | |
Statement stateE1 = (Statement) conE1.createStatement(); | |
String queryE1 = "select distinct Target.IdKerusakan,Kerusakan.NmKerusakan from Target,Kerusakan where Kerusakan.IdKerusakan = Target.IdKerusakan and Target.IdGejala='"+lblId.getText()+"'"; | |
ResultSet rsE1 = (ResultSet) stateE1.executeQuery(queryE1); | |
while (rsE1.next()) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Trik setting akses host mysql server | |
//akses mysql menggunakan user (u) dan password (p) | |
mysql -u root -p | |
//masuk ke mysql | |
Enter password: | |
mysql> use mysql; | |
//berikan akses penuh untuk user menggunakan IP - IP kita adalah 180.251.179.200/ip dari salamweb | |
mysql> GRANT ALL ON *.* to root@'180.251.179.200' IDENTIFIED BY 'root'; | |
//flush hak akes | |
mysql> FLUSH PRIVILEGES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//===============Cari method tampilTabel(); kemudian ganti kodennya jadi ini | |
public void tampilTabel() { | |
if(lblId.getText().contains("E")){ | |
try { | |
hapusIsiTabel(); | |
Connection con = (Connection) Koneksi.getKoneksi(); | |
Statement state = (Statement) con.createStatement(); | |
String query = "select distinct Target.IdKerusakan,Kerusakan.NmKerusakan from Target,Kerusakan where Kerusakan.IdKerusakan = Target.IdKerusakan and Target.IdGejala='"+lblId.getText()+"'"; | |
ResultSet rs = (ResultSet) state.executeQuery(query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//membuat textarea dan scrollpane resizable | |
scrollPane = new JScrollPane(); | |
scrollPane.setAutoscrolls(true); | |
scrollPane.setBounds(120, 330, 524, 72); | |
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); | |
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); | |
contentPane.add(scrollPane); | |
txtSolusi = new JTextArea(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//pasang saat form di load | |
autoNomer("Aturan_Tidak", "T", JFrame.EXIT_ON_CLOSE); //("nama tabel database","string depan",frame) | |
//method | |
public String autoNomer(String tabel,String strAwal,Integer pnj){ | |
String auto=""; | |
try{ | |
java.sql.Statement stat=connect.createStatement(); | |
ResultSet rs=stat.executeQuery("select * from "+tabel); |