Hi Hasan,

welcome aboard !

When we build an application, which layer should we start with?
From top (UI) to bottom(Data Layer) or bottom to top?

C Language is used to be considered as most powerful programming language.

Where you get such info?

Your class is already extend to JFrame. So you don't need to create a new JFrame instance.

public class BusPayment extends JFrame {

    private JButton paynow;
    private JButton cancel;
    private JComboBox<String> jComboBox1;
    private JFrame frame;
    private JLabel label1, label2, label3, label4;
    private JPanel panel1, panel2, panel3;
    private JRadioButton destination1;
    private JRadioButton destination2;
    private JRadioButton destination3;
    private JRadioButton destination4;
    private JRadioButton destination5;
    private JRadioButton destination6;
    private JComboBox company;
    private JTextField passengerstextfield;

    public BusPayment() {

    private void buildPanel() {
        panel1 = new JPanel();
        label1 = new JLabel("Welcome to the Express Bus Ticketing System! ");
        panel2 = new JPanel();
        label2 = new JLabel("Number of Passenger(s): ");
        company = new JComboBox();
        passengerstextfield = new JTextField(8);
        label3 = new JLabel("Selected Bus Company: ");
        final JComboBox<String> comp = new JComboBox<>(new String[]{"Company1", "Company2", "Company3", "Company4"});
        panel3 = new JPanel();
        label4 = new JLabel("Select a ticket: ");
        destination1 = new JRadioButton("Destination 1 RM15");
        JRadioButton des1 = new JRadioButton(Double.toString(15));
//        des1.add(des1);
        destination2 = new JRadioButton("Destination 2 RM18");
        JRadioButton des2 = new JRadioButton(Double.toString(18));
//        des2.add(des2);
        destination3 = new JRadioButton("Destination 3 RM15");
        JRadioButton des3 = new JRadioButton(Double.toString(15));
//        des3.add(des3);
        destination4 = new JRadioButton("Destination 4 RM12");
        JRadioButton des4 = new JRadioButton(Double.toString(12));
//        des4.add(des4);
        destination5 = new JRadioButton("Destination 5 RM16");
        JRadioButton des5 = new JRadioButton(Double.toString(16));
//        des5.add(des5);
        destination6 = new JRadioButton("Destination 6 RM13");
        JRadioButton des6 = new JRadioButton(Double.toString(13));
//    des6.add(des6);
        paynow = new JButton("Proceed");
        paynow.addActionListener(new PayNowListener());
        cancel = new JButton("Cancel");
        cancel.addActionListener(new CancelListener());

        panel3.add(cancel); ...

Hi All,

Thanks for the reply. I have tested and it works fine.
I will share the screen shot next time if this issue happened again.


I got null pointer exception because you did not initialize frame.

frame = new JFrame();

Geanna Afera commented: Oh I see. Is there anything else that is wrong in my code? +0

Are there any differencies between these two code ?

    if (!a.equals("")) {


  if (a!="") {

I have changed my email from Hotmail to gmail, but still not receive any email .

Uuh, why refuse ?

Or I'm the only one who face this ?

Recently I realized that I not receive any email notification from DaniWeb. When I check on the User Settings, I saw this alert message

We have been having problems emailing you. Has your email address changed? Please update your email address to begin receiving email from us again.

After I re-write my email, this message changed to

An email to verify your account has been sent to xxx@hotmail.com. Please click the link in the email to confirm your email address.

But when I check my mail, I don't receive any email from DaniWeb.

There are Complementary Goals in profile page. Where can I find the list of goals and what does this used for ?

Hi @Akshay_15,

Why not post your question as a new topic instead of commenting on an old post here ?

the bug still there

Dani commented: Test +0

When I leave a comment (vote with comment ) under someone post , it will increase 2 points for vote up and 0 point for vote down. After I leave the comment and click the vote up button, the user earn 2 points. But after I vote down again, the comment get removed but the user still earning 2 points. The two points should be deducted too, no ?


Dani commented: Test +0

Hope the traffic will increase after this !

First of all, I would like to say that the interface is nice, amazing, and user friendly!!
Thanks Dani and those who work hard on this !!!

But one thing I would like to comment is about the vote and comment. It seems like only users with high reputation allow to use this feature because I get this message when I click the vote up button

You do not have the permissions required to access this page.
Would you like to go back?

Since this feature is not available to all users, why not just make it visible for those users only ?

Dani commented: Testing testing +0

Oh, thanks @happygeek

This is java code.

rproffitt commented: When I first read this, I didn't see that tag. Anyhow, will re-read. +15

Welcome imtylerbanks
Please calm down

happygeek commented: Unlikely, methinks. +0

Thanks all . I finally solved it.

      import java.util.Scanner;

        public class Chapter4 {

            public static void main(String[] args) {
                final int NUMBER_PER_LINE = 5;
                Scanner input = new Scanner(System.in);
                int count = 0;
                int firstNumber = 0;
                int secondNumber = 0;
                System.out.print("Enter first number: ");
                firstNumber = input.nextInt();
                System.out.print("Enter second number: ");
                secondNumber = input.nextInt();

                for (int i = firstNumber; i < secondNumber + 1; i++) {
                    if ((i % 3 == 0) && (i % 4 == 0)) {
                        if (count % NUMBER_PER_LINE == 0) {
                        } else {
                            System.out.print(i + "  ");

JamesCherrill commented: Very nicely done John. +14