Disable all grid jobs

Hello Everyone !
I am looking for a way to disable all jobs in grid control and then re-enable all.
Your help is much appreciated.
Regards
Neo

Are you looking to disable all of the Jobs submitted thru EM? Or the background jobs that EM runs via DBMS_JOBS (10/11g) or DBMS_SCHEDULER (12c) ??

Similar Messages

  • Alternative step on Biztalk "terminator" process, regarding disabling all sql server jobs prior to running.

    I am getting errors in one of the BT jobs, they recommend running a terminator tool available from MS ... One of the requirements is to disable all the sql server jobs, my question is: Can I just stop the sql server agent? Or this won't do it ....
    Thanks
    Bico Bielich

    Hi,
    I assume that you are talking about issue identified by Monitor BizTalk Server job.
    Why you want to stop the sql server agent? There could be other Non-BizTalk jobs running too.
    You just need to make sure that you have a BizTalk Backup of your databases, all the BTS hosts have been stopped,
    BTS SQL Agent jobs have been disabled.
    Refer: 
    http://blogs.msdn.com/b/biztalkcpr/archive/2011/02/10/using-biztalk-terminator-to-resolve-issues-identified-by-biztalk-msgboxviewer.aspx
    Pls follow the link and perform action based on the respective issue reported by the
    Monitor BizTalk Server job.
    Rachit

  • [Forum FAQ] How do I disable all subscriptions without disabling Reporting Services and SQL Server Agent?

    Introduction
    There is the scenario that users configured hundreds of subscriptions for reports. Now they want to disable all the subscriptions, but Reporting Services and SQL Server Agent service should be enable, so the subscriptions will not delivery reports to users
    and users could run the reports and create jobs on the server.
    Solution
    To achieve this requirement, we need to list all subscriptions and their schedules by running query, then use loop statement to disable all the subscription schedules by Job name.
    On the Start menu, point to All Programs, point to Microsoft SQL Server instance, and then click SQL Server Management Studio.
    Type Server name and select Authentication, click Connect.
    Click New Query in menu to open a new Query Editor window.
    List all subscriptions and their schedules by running the following query:
    Use ReportServer
    go
    SELECT   c.[Name] ReportName,           
    s.ScheduleID JobName,           
    ss.[Description] SubscriptionDescription,           
    ss.DeliveryExtension SubscriptionType,           
    c.[Path] ReportFolderPath,           
    row_number() over(order by s.ScheduleID) as rn             
    into
    #Temp  
    FROM     
    ReportSchedule rs           
    INNER JOIN Schedule s ON rs.ScheduleID = s.ScheduleID           
    INNER JOIN Subscriptions ss ON rs.SubscriptionID = ss.SubscriptionID           
    INNER JOIN [Catalog] c ON rs.ReportID = c.ItemID AND ss.Report_OID = c.ItemID   
    select * from #temp
    Use the loop statement to disable all the subscription schedules by Job name:
    DECLARE
    @count INT,
    @maxCount INT  
    SET @COUNT=1  
    SELECT @maxCount=MAX(RN)
    FROM
    #temp         
    DECLARE
    @job_name VARCHAR(MAX)                  
    WHILE @COUNT <=@maxCount        
    BEGIN      
    SELECT @job_name=jobname FROM #temp WHERE RN=@COUNT  
    exec msdb..sp_update_job @job_name = @job_name,@enabled = 0     
    SET @COUNT=@COUNT+1   P
    RINT @job_name   
    END   
    PRINT @COUNT 
    Reference
    SQL Agent – Disable All Jobs
    Applies to
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012
    Reporting Services 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • How to export Oracle 10g Enterprise Manager Grid jobs?

    I need to save all current Oracle 10g Enterprise Manager Grid jobs before our migration. We are running Oracle 10.1.0.4 on Solaris 9. How can I save off the jobs to a file and re-import these after our migration into the new Grid server?
    Thanks,
    Ben Prusinski

    Hi!
    Have you been able to export your jobs? If you have, I would appreciate it if you could share it with me..
    Thanks!!

  • How to cancell all scheduled jobs

    Is there a Command line (or) any other option to kill all scheduled jobs, because when cloning of data happens from Production to other testing instance, scheduled jobs will still be running and are consuming space.
    We could use admin screen , killing one by one is taking lot of time.
    Appreciate your input
    Thanks

    Hi user10596151,
    you can try the following:
    To disable all of the scheduled workbooks immediately, use the following PL/SQL block. The PL/SQL block should be run as a privileged user (such as 'system').
    Declare
    cursor c1 is
    select job from all_jobs where what like '%EUL5%';
    begin
    for i in c1 loop
    dbms_job.broken(i.job,true);
    end loop;
    end;
    Note: For Discoverer 4 replace EUL5 with EUL4

  • Custom button in alv and disabling all buttons in application tool bar

    Experts,
    Could you please  help me for the below requirements.
    1). How to disable all the buttons (like sorting, print, find, set filter...etc.) in tool bar using oops?
    2). Where can I add my custom download button in alv report using oops?
    Thanks in advance...
    Sridhar..

    Step1:
    Create on local class
    Class <LCL_EVENT_RECEIVER> Definition
    Define the below public methods.
    Method Name     HANDLE_TOOLBAR
    Event Name     TOOLBAR
    Event Class     CL_GUI_ALV_GRID
    Importing     E_OBJECT, E_INTERACTIVE
    Method Name     HANDLE_USER_COMMAND
    Event Name     USER_COMMAND
    Event Class     CL_GUI_ALV_GRID
    Importing     E_UCOMM
    Class <LCL_EVENT_RECEIVER> Implementation 
    .     Method HANDLE_TOOLBAR
         Declare the structure <LS_TOOLBAR> of structure type STB_BUTTON
         Append the button information as given below into table E_OBJECT->MT_TOOLBAR to         display the custom button on ALV grid.
                               LS_TOOLBAR-FUNCTION = u2018DOWNu2019
                         LS_TOOLBAR-QUICKINFO = u2018downloadu2019
                         LS_TOOLBAR-TEXT = u2018downloadu2019
         Method HANDLE_USER_COMMAND
    In this method if E_UCOMM = u2018DOWNu2019 write your logic.
    Step2:
    1.     To excluding the ALV grid buttons, fill the <LT_EXC> with function code CL_GUI_ALV_GRID=>MC_FC_EXCL_ALL
    2.     To generate the ALV Grid, call the method SET_TABLE_FOR_FIRST_DISPLAY
    Class     CL_GUI_ALV_GRID
    Method Name     SET_TABLE_FOR_FIRST_DISPLAY
    Exporting     
    I_STRUCTURE_NAME      ZDS_CM_EXT_SEL
    LS_LAYOUT                    <LS_LAYOUT>
    IT_TOOLBAR_EXCLUDING     <LT_EXC>
    Changing     
    IT_OUTTAB                    <GT_EXT_SEL>
    Create the Instance for class <LCL_EVENT_RECEIVER>
    Class     <LCL_EVENT_RECEIVER>
    Instance Name     <LO_EVENT_FNAME>
    Now set handler  <HANDLE_USER_COMMAND> and <HANDLE_TOOLBAR_FNAME> events using instance <LO_EVENT_FNAME>
    Call method 'SET_TOOLBAR_INTERACTIVE' to raise event TOOLBAR
    Class     CL_GUI_ALV_GRID
    Instance Name     <GO_GRID>
    Method Name     SET_TOOLBAR_INTERACTIVE

  • Firefox crashes for 10 seconds when trying to download files, deleting downloads.sqlite, reinstalling firefox, disable all add-ons doesn't solve this problem. Help!

    I am having this problem for weeks now.
    What I tried:
    - Defragmentation
    - Reinstall Firefox on a different location
    - Change download location
    - Start Firefox in safe mode and try download
    - Disable all add-ons and plug-ins
    - Complete malware/spyware scan
    - Complete virus scan
    - Delete downloads.sqlite in the profile folder
    - Uninstall firefox and delete the entire mozilla folder in Roaming location
    - Disabling antivirus
    Nothing helps! I'm only having this problem in Firefox. Downloading with Chrome for example doesn't give any problems.
    How can I resolve this problem? I'm really desperate.
    Thank you in advance!
    Yanco

    Thanks for your input but I already said that I deleted downloads.sqlite.

  • Deleting all print jobs on a computer with network accounts

    In a school environment, we are using a network server with individual student accounts. Is there a way to delete all print jobs for all users on a given computer? I can reset print system and it only clears the print jobs for that single user.

    System Preferences > Printers & Scanners > Print
    Click: Open Print Queue
    You should be able to delete print jobs from there.

  • I'm deploying FF13 in my organization, how can i disable FF from disabling all plugins/extensions by default?

    Our organization requires web services with many plugins. In order to support the latest browsers, we must deploy FF13 company wide. Currently the installation disables all 3rd party plugins by default, requiring you to enable them manually. Therefore, this makes managing a FF13 deployment very difficult. Is there any way to configure it to deploy without it disabling plugins?

    Do you really mean plugins (Tools > Add-ons > Plugins) or do you mean extensions (Tools > Add-ons > Extensions)?
    Firefox shouldn't disable plugins unless they are blacklisted, but will display a dialog that shows which (third-party) extensions are found an allow to enable third party extensions.<br />
    There is probably no way to avoid such an alert, but you can try to copy extensions to the distribution/extensions folder where also the default theme resides.
    *https://developer.mozilla.org/En/Developer_Guide/Customizing_Firefox (Including extensions with your distribution of Firefox)

  • How do I disable all non-essential components in the CS6 installer

    A new question in the spirit of http://forums.adobe.com/thread/548877 and http://forums.adobe.com/message/2778575, where I asked this question for CS4 and CS5 and eventually discovered how to do this (at least for CS4; CS5 was a mess...): How do I disable all the non-essential components in the Photoshop CS6 installer?
    I already found the payloads/Media_db.db sqlite 3 database and wiped the DependencyData table. This goes a long way - unlike CS5, which was a maze of hidden xml configs and sqlite databases, for CS6 just wiping this single table will give the user full control over what the installer will put in the computer. With the dependencies wiped, we can now see all the stuff it's actually going to install:
    Bridge (normal and x64) - 187 and 262 MB
    CMaps (normal and x64) - 7.2 and 7.2 MB
    CSXS Extensions - 1.3MB
    CSXS Infrastructure - 6.8MB
    Color - photoshop, EU, JA, NA - 1.5, 2.1, 3.0, 2.5MB
    Video profiles - 4.7KB
    Dynamic Link Media Server - 96MB
    DynamicLink Support - 6.1MB
    ExtendScript Toolkit - 19MB
    Extension Manageer - 16MB
    Fonts recommended (normal and x64) - 110 and 110MB (why are there x86 and x64 versions? more of an open question than one that really needs an answer, but this is not how fonts work. There are no separate x86 and x64 flavoured OpenType fonts)
    Fonts required (normal and x64) - 123 and 123MB
    Hunspell Linguistics Plugin (normal and x64) - 181 and 181MB
    Linguistics (normal and x64) - 46 and 46MB
    Mini Bridge (normal and x64) - 4.0MB
    PDF Library Files (normal and x64) - 75 and 75MB
    Photoshop (normal and x64) - 486 and 563MB
    Photoshop Support - 9.4MB
    Player for Embedding 3.3 (normal and x64) - 21 and 26MB
    Switchboard 2.0 - 1.1MB
    Type Support (normal and x64) - 6 and 6MB
    Winsoft Linguistics Plugin (normal and x64) - 8.2 and 8.5MB
    XMP Panels - 4.9MB
    ColorCommonSetCMYK - 13MB
    ColorCommonSetRGB - 8.6KB
    Camera Profiles Installer - 285MB
    MSVC++2005 redist. (normal and x64) - 11 and 11MB
    MSVC++2008 redist. (normal and x64) - 11 and 11MB
    MSVC++2010 redist. (normal and x64) - 11 and 11MB
    MSVC80_CRT (normal and x64) - 0.0 and 0.0KB
    PDF Settings - 2.4MB
    Camera Raw 7  (normal and x64) - 22 and 24MB
    Suite Shared Configuration - 3.2MB
    Some of these things we really want installed (Photoshop, CMaps, XMP panels, Type Support and required fonts and color profiles are pretty much the minimal set required for a functional Photoshop installation), but some of these things really have no right to be silentedly installed. There's a good gigabyte of nonsense that someone who just wants Photoshop has no need for. Denying them the option to unselect these things during installation is a bit evil (whatever happened to the 'advanced' or 'custom' installation option? That was a good option).
    That said, there's still something funky going on - unselecting all components indicates that the installation will required 0.0KB on disk. However, selecting Photoshop CS6 x64, which indicates its size is 563MB, results in an installation that requires 677MB on disk. Similar things happen for other components; CMaps is 7.2MB, but when you select it, it suddenly requires 121MB on disk.
    Much last last time, I fully appreciate the install team's choices in making sure the installer will always work as long as people don't tamper with it, but I'm not one of those people - I do tamper with it, because I want to control exactly what lands on my disk. So: how do I find out what these secret things are that are not listed after wiping the dependency data so that I can explicitly pick individual components? Which additional steps are required to reveal the hidden dependencies that will apparently still be installed, or aren't factored into the size indication for the various components? And finally, how do I make the installer NOT determine that "this is not a genuine installer, you may have a counterfeit product" =)
    I know it's been altered; I modified it, because I think your install process is trying to force stuff onto my computer that I never asked for, nor will ever use (I know they're quality products, they just have no right to exist on my computers. If I had the choice to say no, I'd acknowledge them as quality products instead).
    - Mike Kamermans
    nihongoresources.com
    NB: if Eric Wilde ends up replying to this post: I still remember your willingness to help figure this out for CS5, two years ago. Thank you again for that.

    I can see why you wouldn't want to release information that lets people set up arbitrary installers, but that's why I mostly wanted those two specific hashes. The installer team can just generate them without ever saying how, and we will only be able to use them to validate the installer for the modification that lets you pick components. This should in no way interfere with the desire to prevent dangerous installers making it into the wild; in fact, it kind of guarantees that's impossible.
    I know you can't guarantee it'll work or test it, and that's fine. Past experience has shown that CS3, CS4 and CS5 work fine with updates (and most updates don't apply to Photoshop, they apply to the additional components that I traditionally don't install), so I'm pretty sure it'll work fine with CS6 too, although of course it could go wrong in which case I can always fall back to a normal install.
    Would you be willing to ask the install team whether they could generate just these two numbers, based on the single SQL command run on Media_db.db from the main payload directory? I can fully understand not wanting to give the "here is how you generate the hashes" information, but generating two specific numbers that don't work for anything but this specific query should be just as safe as the various hashes we can already see for the other Media_db.db files in the various payload directories (so they wouldn't reveal anything not already known about how to reverse engineer the hashing algorithm). It'd help tech-savvy customers quite a bit without playing into the hands of criminally minded jerks (I actually had the pleasure of running into a duped CS3 Extended disc several years ago! I had ordered CS3 for personal use, and mysteriously received a CS3 extended version with a volume licensing key in what looked like an official normal CS3 box. Needless to say, authorities and Adobe were notified).
    <<I think the right answer to this issue is to simply remove from the products those items that are not required to execute the product. That's actually something we're aggressively pursuing this summer so that the product size reduces in future releases, particularly for PS.>>
    It's not possible to take components out of the payloads directory without the installer complaining that errors have occurred. It really wants all those files there when it starts =(
    <<Have you investigated using AAMEE? I don't think that will get rid of all the "extraneous" pieces; but, it does provide some flexibility in creating an install package that can then be pushed out through normal deployment tools (e.g. SCCM).>>
    I did, but unfortunately AAMEE requires the use of a volume license key, which I don't have. We only have individual products keys for the machines that will get Photoshop CS6.
    - Mike

  • I'm having issues with Time Machine since my upgrade to Mavericks, running at a snails pace.  Is anyone else experiencing the same?  WiFi is running fine, disabled all the Anti-Virus, still barely runs.

    Is anyone else experiencing the same?  WiFi is running fine, disabled all the Anti-Virus, still barely runs.
    2013 27" iMac

    I'm having the same issue, mine says prepairing to backup. I let it run for 12 hours and it never performed a backup. I have a Mac Book Pro

  • How to view ALL batch job details (SM37) at one glance ?

    Dear all,
    I am documenting all released batch job details, the information required includes the job name, client number, job frequency .. etc.
    In order to see that information, i go to SM37 and click on each job to see the details. I have about 60 jobs released, to get their details i have to click on them at least 60 times.
    Is there a report or table that i can refer to that provides me the information of all the jobs in one screen ?
    Thanks.
    Advice and comment will be appreciated.
    Regards,
    Kent

    Dear Prashanth,
    Thanks for the link, I managed to get the required information from table TBTCO or TBTCP with below selected fields.
    JOBNAME = Background job name
    SDLSTRTDT = Planned Start Date for Background Job
    SDLSTRTTM = Planned start time for background Job
    SDLUNAME = Initiator of job/step scheduling
    PRDMINS = Duration period (in minutes) for a batch job
    PRDHOURS = Duration period (in hours) for a batch job
    PRDDAYS = Duration (in days) of DBA action
    PRDWEEKS = Duration period (in weeks) for a batch job
    PRDMONTHS = Duration period (in months) for a batch job
    PERIODIC = Periodic jobs indicator ('X')
    STATUS = State of Background Job, S = Released, F = Finished
    AUTHCKMAN = Background client for authorization check
    EVENTID = Background Processing Event
    EVENTPARM = Background Event Parameters (Such as, Jobname/Jobcount)
    Dear Juan,
    Thanks for your reply.
    Regards,
    Kent

  • How can I disable all the components in a JPanel?

    I want to disable all the components( button, text field ) in a JPanel. I know I can search the panel and disable each of its children component recursively. Is there a better way to do this?

    I want to disable all the components( button, text field ) in a JPanel.You haven't defined what you mean by "disable".
    If you mean you want the component to be repainted in its disabled state, then you would need to set the property of each individual component to disable, which would imply some kind of recursion.
    If you just want to prevent components from receiving key events and mouse events, then you can use a glass pane or maybe a panel with an overlay layout that contains a non-opaque panel that intercepts all events.

  • Firefox with one tab open takes up 72 Mb. I disabled all of my Add-ons. How do I solve this?

    I disabled all of my add-ons and my Firefox theme is the default that comes with the download.
    I cleared my Cache every time I start Firefox up, and I set my internet history to automatically become deleted once I close my Firefox.
    The problem is that despite all of my add-ons being disabled and my internet history becoming wiped clean once I close the program Firefox, ***With only one tab open*** takes up 48 Mb.
    One time I had only ten tabs open and it took up 600,000 k in my processes (585 Mb.)
    This is driving me crazy as in I have been trying to figure it out all day.
    I used the Google Chrome Web browser but every tab I open up it creates a new Chrome in the processes and each process takes up 48 Mb.
    What is going on?
    I used Firefox 3.6
    and then I tried Firefox 4
    both did the same thing. What can I do to fix this?'''bold text'''

    hello, please install the search reset addon - it will revert the most common customizations those adware programs do in firefox back to the default: https://addons.mozilla.org/firefox/addon/searchreset/

  • Disable all the previous dates in a calendar form

    hi guys,
    I am having a calendar form in which it displays all the previous,current,future dates and months.when i click on the particular button on the
    calendar it dispalys the date, month, and year.its working fine.But what i need is, i want to disable all the previous dates in the calendar till the current
    date.But not to disable the previous button.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class CalendarForm extends JFrame
    JButton[] btn = new JButton[49];
    int month = java.util.Calendar.getInstance().get(java.util.Calendar.MONTH);
    int year = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR);
    JLabel lbl = new JLabel("", JLabel.CENTER);
    JTextField tf1=new JTextField();
    public CalendarForm()
    buildGUI();
    setDates();
    public void buildGUI()
    setLocation(200,350);
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    String[] header = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
    JPanel midPanel = new JPanel(new GridLayout(7,7));
    midPanel.setPreferredSize(new Dimension(350,250));
    for(int x = 0; x < btn.length; x++)
    final int selection = x;
    btn[x] = new JButton();
    btn[x].setFocusPainted(false);
    if(x>6)
    btn[x].addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent ae){
    displayDatePicked(btn[selection].getActionCommand());}});
    if(x < 7)
    {btn[x].setFont(new Font("Lucida", Font.PLAIN, 8)); btn[x].setText(header[x]);}
    midPanel.add(btn[x]);
    JPanel lowPanel = new JPanel(new GridLayout(1,3));
    JButton prevBtn = new JButton("<< Previous");
    prevBtn.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent ae){
    month--;setDates();}});
    lowPanel.add(prevBtn);
    lowPanel.add(lbl);
    JButton nextBtn = new JButton("Next >>");
    nextBtn.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent ae){
    month++;setDates();}});
    lowPanel.add(nextBtn);
    getContentPane().add(midPanel,BorderLayout.CENTER);
    getContentPane().add(lowPanel,BorderLayout.SOUTH);
    pack();
    public void setDates()
    for(int x = 7; x < btn.length; x++) btn[x].setText("");
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMMM yyyy");
    java.util.Calendar cal = java.util.Calendar.getInstance();
    cal.set(year,month,1);
    int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
    int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
    for(int x = 6+dayOfWeek,day = 1; day <= daysInMonth; x++,day++) btn[x].setText(""+day);
    lbl.setText(sdf.format(cal.getTime()));
    setTitle("Calendar - "+lbl.getText());
    public void displayDatePicked(String day)
    if(day.equals("") == false)
    // java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("EEEE d MMMM, yyyy");
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
    java.util.Calendar cal = java.util.Calendar.getInstance();
    cal.set(year,month,Integer.parseInt(day));
    System.out.println(tf1.getText());
    getContentPane().add(tf1,BorderLayout.NORTH);
    // JOptionPane.showMessageDialog(this,"You picked "+sdf.format(cal.getTime()));
    tf1.setText(sdf.format(cal.getTime()));
    System.out.println("from date"+tf1.getText());
    this.setVisible(false);
    public String getFromDate()
    return tf1.getText();
    public static void main(String[] args)
         new CalendarForm().setVisible(true);
    the above  code is to diaplay the calendar form.plzzzzzzzzzzzzzzzz help me. thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    hi michael,i disabled all the previous buttons in a calendar form.this is my code
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DateFormat;
    import java.text.ParseException;
    import java.util.Date;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.*;
    class CalendarForm extends JFrame {
        JButton[] btn = new JButton[49];
        int month = java.util.Calendar.getInstance().get(java.util.Calendar.MONTH);
        int date = java.util.Calendar.getInstance().get(java.util.Calendar.DATE);
        int year = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR);
        JLabel lbl = new JLabel("", JLabel.CENTER);
        JTextField tf1 = new JTextField();
        public CalendarForm() {
            buildGUI();
            setDates();
        private String getMonthAndYearAsString() {
            java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMMM yyyy");
            return sdf.format(new Date(System.currentTimeMillis()));
        private Date getCurrentDate() {
            java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd MM yyyy");
            return new Date();
        public void buildGUI() {
            setLocation(450, 350);
            setDefaultCloseOperation(HIDE_ON_CLOSE);
            String[] header = {"Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"};
            JPanel midPanel = new JPanel(new GridLayout(7, 7));
            midPanel.setPreferredSize(new Dimension(350, 250));
            for (int x = 0; x < btn.length; x++) {
                final int selection = x;
                btn[x] = new JButton();
                btn[x].setFocusPainted(false);
                if (x > 6) {
                    btn[x].addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent ae) {
                            displayDatePicked(btn[selection].getActionCommand());
                if (x < 7) {
                    btn[x].setFont(new Font("Lucida", Font.PLAIN, 8));
                    btn[x].setText(header[x]);
                midPanel.add(btn[x]);
            JPanel lowPanel = new JPanel(new GridLayout(1, 3));
            JButton prevBtn = new JButton("<< Previous");
            prevBtn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    month--;
                    setDates();
                    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMMM yyyy");
                    java.util.Calendar cal = java.util.Calendar.getInstance();
                    cal.set(year, month, 1);
                    int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
                    int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
                    String currentMonth = getMonthAndYearAsString();
                    System.out.println("CURRENT MONTH AND YEAR " + currentMonth);
                    String selectedMonth = sdf.format(cal.getTime());
                    System.out.println("SELECTED MONTH AND YEAR " + selectedMonth);
                    Date currentDate = getCurrentDate();
                    Date selectedDate = new Date(cal.getTimeInMillis());
                    //Comparing currentDate nad selectedDate
                    int off = currentDate.compareTo(selectedDate);
                    int currentDay = date;
                    if (currentMonth.compareTo(selectedMonth) == 0) {
                        for (int x = 7 + dayOfWeek,  day = 1; day <= btn.length; x++, day++) {
                            btn[x].setEnabled(true);
                            if (day < currentDay) {
                                int k = x - 1;
                                for (int j = 7; j <= k; j++) {
                                    btn[j].setEnabled(false);
                    } else if (off == 1) {
                        for (int x = 6 + dayOfWeek,  day = 1; day < daysInMonth; x++, day++) {
                            for (int i = 6 + dayOfWeek; day < currentDay; i++) {
                                btn.setEnabled(false);
    } else if (off == -1) {
    for (int x = 7, day = 1; day < btn.length; x++, day++) {
    btn[x].setEnabled(true);
    lowPanel.add(prevBtn);
    lowPanel.add(lbl);
    JButton nextBtn = new JButton("Next >>");
    nextBtn.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    month++;
    setDates();
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMMM yyyy");
    java.util.Calendar cal = java.util.Calendar.getInstance();
    cal.set(year, month, 1);
    int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
    int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
    String currentMonth = getMonthAndYearAsString();
    System.out.println("CURRENT MONTH AND YEAR " + currentMonth);
    String selectedMonth = sdf.format(cal.getTime());
    System.out.println("SELECTED MONTH AND YEAR " + selectedMonth);
    Date currentDate = getCurrentDate();
    Date selectedDate = new Date(cal.getTimeInMillis());
    //Comparing currentDate and selectedDate
    int off = currentDate.compareTo(selectedDate);
    int currentDay = date;
    if (currentMonth.compareTo(selectedMonth) == 0) {
    for (int x = 7 + dayOfWeek, day = 1; day <= btn.length; x++, day++) {
    btn[x].setEnabled(true);
    if (day < currentDay) {
    int k = x - 1;
    for (int j = 7; j <= k; j++) {
    btn[j].setEnabled(false);
    if (off == -1) {
    for (int x = 7, day = 1; day < btn.length; x++, day++) {
    btn[x].setEnabled(true);
    } else if (off == 1) {
    for (int x = 6 + dayOfWeek, day = 1; day < daysInMonth; x++, day++) {
    for (int i = 6 + dayOfWeek; day < currentDay; i++) {
    btn[i].setEnabled(false);
    lowPanel.add(nextBtn);
    getContentPane().add(midPanel, BorderLayout.CENTER);
    getContentPane().add(lowPanel, BorderLayout.SOUTH);
    pack();
    public void setDates() {
    for (int x = 7; x < btn.length; x++) {
    btn[x].setText("");
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMMM yyyy");
    java.util.Calendar cal = java.util.Calendar.getInstance();
    cal.set(year, month, 1);
    int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
    int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
    lbl.setText(sdf.format(cal.getTime()));
    setTitle("Calendar - " + lbl.getText());
    int currentDay = date;
    for (int x = 6 + dayOfWeek, day = 1; day <= daysInMonth; x++, day++) {
    btn[x].setText("" + day);
    if (day < currentDay) {
    for (int j = 7; j <= x; j++) {
    btn[j].setEnabled(false);
    public void displayDatePicked(String day) {
    if (day.equals("") == false) {
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
    java.util.Calendar cal = java.util.Calendar.getInstance();
    cal.set(year, month, Integer.parseInt(day));
    System.out.println(month);
    System.out.println(tf1.getText());
    tf1.setText(sdf.format(cal.getTime()));
    System.out.println("from date" + tf1.getText());
    // VStudentAttendanceForm class ....
    if (VStudentAttendanceForm.jcalFlag == 1) {
    VStudentAttendanceForm.jtfFromDate.setText(tf1.getText());
    if (VStudentAttendanceForm.jcalFlag == 2) {
    VStudentAttendanceForm.jtfToDate.setText(tf1.getText());
    if (ManageStudents.cal == 1) {
    ManageStudents.jTextField22.setText(tf1.getText());
    ManageStudents.FromjTextField10.setText(tf1.getText());
    if (ManageStudents.cal == 2) {
    ManageStudents.jTextField23.setText(tf1.getText());
    ManageStudents.TojTextField11.setText(tf1.getText());
    if (vAuditTrail.cal == 1) {
    vAuditTrail.jTextField3.setText(tf1.getText());
    if (vAuditTrail.cal == 2) {
    vAuditTrail.jTextField4.setText(tf1.getText());
    if (Attendance.cal == 1) {
    Attendance.jTextField7.setText(tf1.getText());
    if (Attendance.cal == 2) {
    Attendance.jTextField8.setText(tf1.getText());
    this.setVisible(false);
    public String getFromDate() {
    return tf1.getText();
    public static void main(String[] args) {
    new CalendarForm().setVisible(true);

Maybe you are looking for