0% found this document useful (0 votes)
36 views7 pages

Java

This document contains the code for a Java GUI application that displays information about internal combustion engines. It defines labels, text fields, combo boxes, and buttons to display and search engine characteristics. When buttons are clicked, it retrieves input from text fields and displays or searches the information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views7 pages

Java

This document contains the code for a Java GUI application that displays information about internal combustion engines. It defines labels, text fields, combo boxes, and buttons to display and search engine characteristics. When buttons are clicked, it retrieves input from text fields and displays or searches the information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/[Link] to
change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/[Link] to edit this
template
*/
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

/**
*
* @author Nitro
*/
public class InterfataMotoTermica extends [Link] {

private [Link] detalii;


private JPanel panel;

/* Creates new form InterfataMasiniTermice


*/
public InterfataMotoTermica() {
initComponents();
}
/**
}

/**
* 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">

private void initComponents() {

jLabel1 = new [Link]();


jLabel2 = new [Link]();
jLabel3 = new [Link]();
jComboBox1 = new [Link]<>();
jTextField1 = new [Link]();
jTextField2 = new [Link]();
jButton1 = new [Link]();
jPanel1 = new [Link]();

setDefaultCloseOperation([Link].DISPOSE_ON_CLOSE);
setTitle("MASINI TERMICE");
[Link](new [Link]("Tahoma", 3, 14)); // NOI18N
[Link]("CARACTERISTICI MASINI TERMICE");

[Link](new [Link]("Tahoma", 1, 14)); // NOI18N


[Link]("Tip Motor");

[Link](new [Link]("Tahoma", 1, 14)); // NOI18N


[Link]("Tip Turbina");

[Link](new [Link]("Tahoma", 3, 14)); // NOI18N


[Link](new [Link]<>(new String[]
{ "Mai multe", "Motor", "Scaune", "Jante", "Dotari Exterioare", "Dotari
Interioare", " " }));
[Link](new [Link]() {
public void actionPerformed([Link] evt) {
jComboBox1ActionPerformed(evt);
}
});

[Link](new [Link]("Tahoma", 1, 12)); // NOI18N


[Link]("Cautare");
[Link](new [Link]() {
public void actionPerformed([Link] evt) {
jButton1ActionPerformed(evt);
}
});

[Link] jPanel1Layout = new


[Link](jPanel1);
[Link](jPanel1Layout);
[Link](

[Link]([Link])
.addGap(0, 530, Short.MAX_VALUE)
);
[Link](

[Link]([Link])
.addGap(0, 133, Short.MAX_VALUE)
);

[Link] layout = new


[Link](getContentPane());
getContentPane().setLayout(layout);
[Link](
[Link]([Link])
.addGroup([Link]()
.addGroup([Link]([Link]
[Link])
.addGroup([Link]()
.addGap(119, 119, 119)
.addComponent(jLabel1,
[Link].PREFERRED_SIZE, 272,
[Link].PREFERRED_SIZE))
.addGroup([Link]()
.addGap(53, 53, 53)
.addGroup([Link]([Link]
[Link])
.addGroup([Link]()
.addGroup([Link]([Link]
[Link], false)
.addComponent(jComboBox1,
[Link], 0, [Link].DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel3,
[Link], [Link].DEFAULT_SIZE,
[Link].DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup([Link]([Link]
[Link])
.addGroup([Link]()
.addPreferredGap([Link]
[Link])
.addComponent(jTextField2))
.addGroup([Link]()
.addGap(153, 153, 153)
.addComponent(jButton1,
[Link].PREFERRED_SIZE, 142,
[Link].PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup([Link]()
.addComponent(jLabel2,
[Link].PREFERRED_SIZE, 105,
[Link].PREFERRED_SIZE)
.addGap(58, 58, 58)
.addComponent(jTextField1,
[Link].PREFERRED_SIZE, 250,
[Link].PREFERRED_SIZE))
.addComponent(jPanel1,
[Link].PREFERRED_SIZE, [Link].DEFAULT_SIZE,
[Link].PREFERRED_SIZE))))
.addGap(76, 76, 76))
);
[Link](
[Link]([Link])
.addGroup([Link]()
.addGap(31, 31, 31)
.addComponent(jLabel1, [Link].PREFERRED_SIZE, 41,
[Link].PREFERRED_SIZE)
.addPreferredGap([Link]
ED)
.addGroup([Link]([Link]
[Link], false)
.addComponent(jLabel2, [Link].PREFERRED_SIZE,
34, [Link].PREFERRED_SIZE)
.addGroup([Link]()
.addComponent(jTextField1)
.addGap(5, 5, 5)))
.addGroup([Link]([Link]
[Link])
.addComponent(jLabel3, [Link].PREFERRED_SIZE,
34, [Link].PREFERRED_SIZE)
.addComponent(jTextField2,
[Link].PREFERRED_SIZE, 34,
[Link].PREFERRED_SIZE))
.addPreferredGap([Link]
ED)
.addGroup([Link]([Link]
[Link], false)
.addComponent(jComboBox1,
[Link].PREFERRED_SIZE, 35, [Link].PREFERRED_SIZE)
.addGroup([Link]()
.addComponent(jButton1,
[Link].DEFAULT_SIZE, 36, Short.MAX_VALUE)
.addGap(5, 5, 5)))
.addGap(26, 26, 26)
.addComponent(jPanel1, [Link].PREFERRED_SIZE,
[Link].DEFAULT_SIZE, [Link].PREFERRED_SIZE)
.addContainerGap(19, Short.MAX_VALUE))
);

pack();
}// </editor-fold>

private void jComboBox1ActionPerformed([Link] evt) {

// TODO add your handling code here:


[Link](new ActionListener() {

public void actionPerformed(ActionEvent e) {


String selectedValue = (String) [Link]();
if ("Jante".equals(selectedValue) && !
isFrameOpen([Link])) {
new InterfataJante().setVisible(true);
}

if ("Dotari Exterioare".equals(selectedValue) && !


isFrameOpen([Link])) {
new InterfataDotariExterioare().setVisible(true);
}

if ("Motor".equals(selectedValue) && !
isFrameOpen([Link])) {
new InterfataMotor().setVisible(true);
}

}
});
}

private void jButton1ActionPerformed([Link] evt) {

// TODO add your handling code her:e:


// JLabel label1=new JLabel("Tip Motor:");
// JTextField textField1=new JTextField(200);
// JLabel label2=new JLabel("model:");
// JTextField textField2=new JTextField(200);

String tipMotor=[Link]();
String model=[Link]();
// [Link](label1);
// [Link](textField1);
// [Link](label2);
// [Link](textField2);
afiseazaInformatii(tipMotor, model);

}
private void afisareMasina(String tipMotor, String model) {
setTitle("Afisare Moto Termica");
setSize(400, 300);

panel = new JPanel();


[Link](new GridLayout(0, 2));

afiseazaInformatii(tipMotor, model);
JScrollPane scrollPane=new JScrollPane(panel);
getContentPane().add(scrollPane);
setVisible(true);
}
private void afiseazaInformatii(String tipMotor, String model){

Motor[] vectorMotor = new Motor[10];


vectorMotor[0] = new Motor("Benzină", 150, 1998.0);
vectorMotor[1] = new Motor("Motorină", 120, 1598.5);
vectorMotor[2] = new Motor("Benzină", 180, 2499.9);
vectorMotor[3] = new Motor("Motorină", 110, 1399.7);
vectorMotor[4] = new Motor("Benzină", 200, 2999.0);
vectorMotor[5] = new Motor("Benzină", 170, 2299.5);
vectorMotor[6] = new Motor("Motorină", 130, 1699.3);
vectorMotor[7] = new Motor("Benzină", 190, 2599.8);
vectorMotor[8] = new Motor("Benzină", 220, 3499.2);
vectorMotor[9] = new Motor("Motorină", 140, 1799.6);

DotariExterioare[] vectorDotariExterioare = new DotariExterioare[10];


vectorDotariExterioare[0] = new DotariExterioare(true, "Rosu", true);
vectorDotariExterioare[1] = new DotariExterioare(false, "Albastru", false);
vectorDotariExterioare[2] = new DotariExterioare(true, "Verde", true);
vectorDotariExterioare[3] = new DotariExterioare(false, "Negru", false);
vectorDotariExterioare[4] = new DotariExterioare(true, "Gri", true);
vectorDotariExterioare[5] = new DotariExterioare(false, "Alb", false);
vectorDotariExterioare[6] = new DotariExterioare(true, "Portocaliu", true);
vectorDotariExterioare[7] = new DotariExterioare(false, "Galben", false);
vectorDotariExterioare[8] = new DotariExterioare(true, "Argintiu", true);
vectorDotariExterioare[9] = new DotariExterioare(false, "Auriu", false);

Jante[] vectorJante = new Jante[10];


vectorJante[0] = new Jante(8.0, 17.0, "Aliaj", 5);
vectorJante[1] =new Jante(7.5, 16.0, "Oțel", 4);
vectorJante[2] =new Jante(9.0, 18.0, "Aliaj", 6);
vectorJante[3] =new Jante(8.5, 19.0, "Aluminiu", 5);
vectorJante[4] =new Jante(7.0, 15.0, "Oțel", 4);
vectorJante[5] =new Jante(8.0, 18.0, "Aluminiu", 5);
vectorJante[6] =new Jante(7.5, 17.0, "Aliaj", 6);
vectorJante[7] =new Jante(8.5, 20.0, "Aliaj", 5);
vectorJante[8] =new Jante(7.0, 16.0, "Aluminiu", 4);
vectorJante[9] =new Jante(9.0, 19.0, "Aluminiu", 6);

motoTermica[] vectorMotoTermica = new motoTermica[10];


vectorMotoTermica[0] = new motoTermica("Zac","Sportster-Iron-883",
230,vectorMotor[0],vectorJante[0],vectorDotariExterioare[0]);
vectorMotoTermica[1] = new motoTermica("Radu","CBR1000RR-R-Fireblade-SP",
180,vectorMotor[1],vectorJante[1],vectorDotariExterioare[1]);
vectorMotoTermica[2] = new motoTermica("Zac","GSX-R1000",
300,vectorMotor[2],vectorJante[2],vectorDotariExterioare[2]);
vectorMotoTermica[3] = new motoTermica("Radu","Ninja-H2-SX-SE+",
260,vectorMotor[3],vectorJante[3],vectorDotariExterioare[3]);
vectorMotoTermica[4] = new motoTermica("Zac","Panigale-V4-
S",210,vectorMotor[4],vectorJante[4],vectorDotariExterioare[4]);
vectorMotoTermica[5] = new motoTermica("Radu","YZF-R1M",
190,vectorMotor[5],vectorJante[5],vectorDotariExterioare[5]);
vectorMotoTermica[6] = new motoTermica("Zac","S1000RR",
240,vectorMotor[6],vectorJante[6],vectorDotariExterioare[6]);
vectorMotoTermica[7] = new motoTermica("Radu","R1",
220,vectorMotor[7],vectorJante[7],vectorDotariExterioare[7]);
vectorMotoTermica[8] = new motoTermica("Zac","Diavel-1260-S",
240,vectorMotor[8],vectorJante[8],vectorDotariExterioare[8]);
vectorMotoTermica[9] = new motoTermica("Radu","Street-Triple-RS",
250,vectorMotor[9],vectorJante[9],vectorDotariExterioare[9]);

for(int i=0; i<[Link]; i++){


if (vectorMotoTermica[i]!=null && "ardere
interna".equals(vectorMotoTermica[i].tipMotor) &&
"Model".equals(vectorMotoTermica[i].model)) {
{
JLabel label1=new JLabel("Model " + vectorMotoTermica[i].model);
JLabel label2=new JLabel("Marca " + vectorMotoTermica[i].marca);
JLabel label3=new JLabel("Km Parcursi " +
vectorMotoTermica[i].kmParcursi);
JLabel label4=new JLabel("Tip Motor " +
vectorMotoTermica[i].tipMotor);
JLabel label5 = new JLabel("Tip Turbina " +
vectorMotoTermica[i].model);
[Link](label1);
[Link](label2);
[Link](label3);
[Link](label4);
[Link](label5);

}
}
[Link](true);
}
}

private boolean isFrameOpen(Class<?> frameClass) {


Frame[] frames = [Link]();
for (Frame frame : frames) {
if ([Link](frame) && [Link]()) {
return true;
}
}

return false;}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the
default look and feel.
* For details see
[Link]
*/
try {
for ([Link] info :
[Link]()) {
if ("Nimbus".equals([Link]())) {
[Link]([Link]());
break;
}
}
} catch (ClassNotFoundException ex) {

[Link]([Link]()).log(java
.[Link], null, ex);
} catch (InstantiationException ex) {

[Link]([Link]()).log(java
.[Link], null, ex);
} catch (IllegalAccessException ex) {

[Link]([Link]()).log(java
.[Link], null, ex);
} catch ([Link] ex) {

[Link]([Link]()).log(java
.[Link], null, ex);
}
//</editor-fold>

/* Create and display the form */

[Link](new Runnable() {
public void run() {
new InterfataMotoTermica().setVisible(true);
}
});
}

// Variables declaration - do not modify


private [Link] jButton1;
private [Link]<String> jComboBox1;
private [Link] jLabel1;
private [Link] jLabel2;
private [Link] jLabel3;
private [Link] jPanel1;
private [Link] jTextField1;
private [Link] jTextField2;
// End of variables declaration
}

You might also like