pcboyyyy's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
101 (0.06 per day)
Joined:
29-August 10
Profile Views:
7,996
Last Active:
User is offline Dec 01 2014 06:48 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Mitsubishi
Dream Kudos:
0

Latest Visitors

Icon   pcboyyyy Help on my Calendar Event thread would be much appreciated.

Posts I've Made

  1. In Topic: Java Calendar Applet

    Posted 28 Nov 2014

    Can someone toss me a bone here? I know some of you can help answer my latest question...
  2. In Topic: Java Calendar Applet

    Posted 26 Nov 2014

    Ok, I'm taking a different approach to my applet.

    I would like to call in the month and current year for the calendar header and I'm having an issue doing that.

    Here is my code right now:

    import java.awt.*;
    import java.util.GregorianCalendar;
    import javax.swing.*;
    
    	public class CalendarDisplayApplet extends JApplet {
    	    // Instance Variables
    	    GregorianCalendar calendar = new GregorianCalendar();
    	    int arrange = 7;
    	    int column = 7;
    	    String[] week = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
    	    String[] month = { "January", "Februrary", "March", "April", "May", "June", "July", "August",
    	    		"September", "October", "November", "December"};
    	    JLabel[][] grid = new JLabel[arrange][column];
    	   	JPanel jpnlCalendar = new JPanel(new GridLayout(7, 7));
    	    int today = calendar.get(GregorianCalendar.DAY_OF_MONTH);
    	    int daysInMonth = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
    	    int daysInWeek = calendar.get(GregorianCalendar.DAY_OF_WEEK);
    
    	    public void init() {
    	        // setting grid
    	        for (int i = 0; i < grid.length; i++) {
    	            for (int j = 0; j < grid[0].length; j++) {
    	                grid[i][j] = new JLabel();
    	            }
    
    	        }
    	        // grid layout
    	        Container contenu = getContentPane();
    	        for (int i = 0; i < arrange; i++) {
    	            for (int j = 0; j < column; j++) {
    	                jpnlCalendar.add(grid[i][j]);
    	            }
    	        }
    	        
    	        // adding JPanels + positions
    	        contenu.add(jpnlCalendar);
    
    	        // draw week days
    	        for (int i = 0; i < week.length; i++) {
    	            grid[0][i].setText(week[i]);
    	        }
    	        // draw name of month
    	        //for (int m = 0; m < month.length; m++) {
    	            //grid[0][m].setText(month[m]);  
    	       // }
    
    	        //conditions for the calendar
    	        calendar.set(GregorianCalendar.DAY_OF_MONTH, 1);
    	        int daysInWeek = calendar.get(GregorianCalendar.DAY_OF_WEEK)- 1;
    	        System.out.print(daysInWeek);
    	        if (daysInWeek == 0)
    	            daysInWeek = 7;
    	        calendar.set(GregorianCalendar.DAY_OF_MONTH, today);
    
    	        int days = 1;
    
    	        for (int k = daysInWeek; k < column; k++) {
    	            grid[1][k].setText(days + "");
    	            if (days == today)
    	                grid[1][k].setText(days + "*");
    	            days++;
    	        }
    	        // draw calendar
    	        for (int i = 2; i <= column; i++) {
    	            for (int j = 0; j < arrange; j++) {
    	                if (days <= daysInMonth) {
    	                    grid[i][j].setText(days + "");
    	                    if (days == today)
    	                        grid[i][j].setText(days + "*");
    	                    days++;
    	                }
    	            }
    	        }
    
    	    }
    	}
    
    
    
    
    
  3. In Topic: Java Calendar Applet

    Posted 25 Nov 2014

    My apologies. I just saw the latest reply.

    I'm still confused...
  4. In Topic: Java Calendar Applet

    Posted 25 Nov 2014

    View Postg00se, on 25 November 2014 - 10:24 AM, said:

    printCalendarMonthYear needs to be made to return String. That will solve your problem


    I see, but I don't fully understand what you mean? Are you talking about inside of the applet class or do I need to change something in my calc class as well?

    Can you provide an example for me?

    Thanks for the good piece of information.
  5. In Topic: Java Calendar Applet

    Posted 25 Nov 2014

    Right. I am not sure how to call the method into my applet class.

    The method will do the work to create a calendar and display it through my applet.

    It can't be done using JLabel, I need to use JText.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Interests:
Engineering, software, hardware, computers, reading, golf, e-commerce, business, networking, retail.
Years Programming:
12
Programming Languages:
VB.NET, C#, C++, C, Java, PHP, CSS, HTML.

Contact Information

E-mail:
Click here to e-mail me

Comments

pcboyyyy has no profile comments yet. Why not say hello?