0% found this document useful (0 votes)
30 views4 pages

Darwin 216661029 TampilanPenjualan

The document describes source code for a Java program that creates a GUI for a car dealership sales display using AWT and Swing. The GUI contains fields for customer information, vehicle selection, transmission selection, color selection and total price. It includes panels for input fields, radio buttons, checkboxes and buttons to order or cancel an order.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

Darwin 216661029 TampilanPenjualan

The document describes source code for a Java program that creates a GUI for a car dealership sales display using AWT and Swing. The GUI contains fields for customer information, vehicle selection, transmission selection, color selection and total price. It includes panels for input fields, radio buttons, checkboxes and buttons to order or cancel an order.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

NAMA:Darwin

NIM:216661029

Kelas:TRK3B

Membuat tampilan penjualan menggunakan java awt dan swing

Source code:

/**

* @author darwin

*/

import java.awt.*;

import javax.swing.*;

import java.awt.Color;

import javax.swing.border.TitledBorder;

public class Dealer_Toyota {

public static void main(String[] a) {

JFrame myFrame = new JFrame("TOYOTA SAMARINDA");

myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Container myPane = myFrame.getContentPane();

myPane.setLayout(new BorderLayout());

myPane.add(getFieldPanel(), BorderLayout.NORTH);

myPane.add(getButtonPanel(), BorderLayout.SOUTH);

myFrame.pack();

myFrame.setVisible(true);

private static JPanel getFieldPanel() {

JPanel p = new JPanel(new GridLayout(9, 2, 10, 10));


p.setBackground(Color.WHITE);

p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.RED, 2),
"Daftar Harga Mobil", TitledBorder.LEFT, TitledBorder.TOP, new Font("Serif", Font.BOLD, 24),
Color.BLACK));

p.add(new JLabel("Nama Pemesan:",SwingConstants.LEFT));

p.add(new JTextField(35));

p.add(new JLabel("Alamat:",SwingConstants.LEFT));

p.add(new JTextField(35));

p.add(new JLabel("No. Telp:",SwingConstants.LEFT));

p.add(new JTextField(35));

p.add(new JLabel("Pembayaran:",SwingConstants.LEFT));

p.add(getLanguagePanel());

p.add(new JLabel("Type mobil:",SwingConstants.LEFT));

JComboBox<String> cb = new JComboBox<String>(

new String[] {"Avanza - Rp 250.000.000","Veloz - Rp 280.000.000","Raize - Rp 300.000.000"});

p.add(cb);

p.add(new JLabel("Transmisi:",SwingConstants.LEFT));

p.add(getSystemPanel());

p.add(new JLabel("Warna mobil:",SwingConstants.LEFT));

p.add(new JComboBox<String>(

new String[] {"Hitam","Putih","Merah","Kuning","Biru"}));

p.add(new JLabel("Total Harga:", SwingConstants.LEFT));

JTextField totalPriceField = new JTextField(35);

totalPriceField.setEditable(false);

p.add(totalPriceField);

return p;

}
private static JPanel getButtonPanel() {

JButton pesanButton = new JButton("Pesan");

pesanButton.setBackground(Color.GREEN);

JButton batalkanButton = new JButton("Batalkan");

batalkanButton.setBackground(Color.GREEN);

JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));

p.setBackground(new Color(255, 0, 0));

p.add(pesanButton);

p.add(batalkanButton);

return p;

private static JPanel getSystemPanel() {

JRadioButton unixButton = new JRadioButton("Automatic",true);

JRadioButton winButton = new JRadioButton("Manual",false);

ButtonGroup systemGroup = new ButtonGroup();

systemGroup.add(unixButton);

systemGroup.add(winButton);

JPanel p = new JPanel(new GridLayout(1,2));

p.add(unixButton);

p.add(winButton);

return p;

private static JPanel getLanguagePanel() {


JPanel p = new JPanel(new GridLayout(1,3));

p.add(new JCheckBox("Cash",true));

p.add(new JCheckBox("Kredit",true));

p.add(new JCheckBox("SPK",false));

return p;

OUTPUT:

You might also like