How to make 3 similar fun's does generate different sql string in 1 db call

Hi All,
In my sql package I'm using 3 different functions to create two different sql strings and the 3rd function does some percentage calculations. My Db architect on code review suggest me that those two functions are almost the same except the sql string it does generate. So she asked me to write one function that does everything in one db call.
"_Function 1_"
FUNCTION get_class_select_text
     in_report_parameter_id IN NUMBER
RETURN VARCHAR2
IS
my_class_select_text VARCHAR2(10000);
my_class_select_value VARCHAR2(10000);
CURSOR class_select_text IS
     SELECT 'SUM(DECODE(bin_id, ' || report_parameters.report_parameter_value
                    || ', bin_value, 0)) "Class ' || report_parameters.report_parameter_value || '" '
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS'
GROUP BY
report_parameters.report_parameter_value
ORDER BY
CAST(report_parameters.report_parameter_value AS NUMBER);
BEGIN
my_class_select_text := '';
OPEN class_select_text;
LOOP
FETCH class_select_text INTO my_class_select_value;
EXIT WHEN class_select_text%NOTFOUND;
my_class_select_text := my_class_select_text || ', ' || my_class_select_value;
END LOOP;
CLOSE class_select_text;
RETURN my_class_select_text;
END get_class_select_text;
FUNCTION 2:
FUNCTION get_class_sum_text
     in_report_parameter_id IN NUMBER
RETURN VARCHAR2
IS
my_class_sum_text VARCHAR2(10000);
my_class_sum_value VARCHAR2(10000);
CURSOR class_sum_text IS
     SELECT 'SUM(NVL("Class ' || report_parameters.report_parameter_value || '", 0)) "Class ' || report_parameters.report_parameter_value || '" '
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS'
GROUP BY
report_parameters.report_parameter_value
ORDER BY
CAST(report_parameters.report_parameter_value AS NUMBER);
BEGIN
my_class_sum_text := '';
OPEN class_sum_text;
LOOP
FETCH class_sum_text INTO my_class_sum_value;
EXIT WHEN class_sum_text%NOTFOUND;
my_class_sum_text := my_class_sum_text || ', ' || my_class_sum_value;
END LOOP;
CLOSE class_sum_text;
RETURN my_class_sum_text;
END get_class_sum_text;
FUNCTION 3:
FUNCTION get_class_perc_text
     in_report_parameter_id IN NUMBER
RETURN VARCHAR2
IS
my_class_perc_text VARCHAR2(10000);
my_class_perc_value VARCHAR2(10000);
CURSOR class_perc_text IS
SELECT 'ROUND((("Class ' || report_parameters.report_parameter_value || '" / "Total") * 100), 2) "Class ' || report_parameters.report_parameter_value || '" '
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS'
GROUP BY
report_parameters.report_parameter_value
ORDER BY
CAST(report_parameters.report_parameter_value AS NUMBER);
BEGIN
my_class_perc_text := '';
OPEN class_perc_text;
LOOP
FETCH class_perc_text INTO my_class_perc_value;
EXIT WHEN class_perc_text%NOTFOUND;
my_class_perc_text := my_class_perc_text || ', ' || my_class_perc_value;
END LOOP;
CLOSE class_perc_text;
my_class_perc_text := my_class_perc_text || ', ' || 'DECODE("Total", -1, 0, 100) "Total" ';
RETURN my_class_perc_text;
END get_class_perc_text;
Could anyone help me?
Thanks in advance.

Hi ,
Thanks a lot for your reply and tips how to post the code.
As you know that previously I used 3 different variables called
my_class_select_text,
my_class_sum_text,
my_class_perc_text
to get corresponding values. I'm using these values in a dynamic SQL like below in the code.
      SELECT 3 "Rank", '
    || '            ''Final Row'' "Row Type", '
    || '            TRUNC(edr_rpt_tmp_bin_periods.bin_start_date_time ) "Date", '
    || '            MAX(edr_rpt_tmp_bin_periods.bin_end_date_time) - numtodsinterval(0.000000001, ''SECOND'') "Date/Time", '
    || '            '''' "Lane", '
    || '            ''Total'' "Hour"  '
    ||              my_class_sum_text
    || '                           , '
    || '             SUM(NVL(" ", 0)) " " '
    || '           FROM ( '
    || '                  SELECT edr_class_by_hour_report_data.bin_start_date_time start_date_time '
    ||                               my_class_select_text || ', '
    || '                             SUM(NVL(edr_class_by_hour_report_data.bin_value, 0)) " " '
    || '                    FROM edr_class_by_hour_report_data '
    || '             GROUP BY edr_class_by_hour_report_data.bin_start_date_time '
    || '                ) results '
   As per your new function it returns in a single parameter called 'my_class_perc_text' . Now I dont know how to use single variable in these places?
Hope you could understand my question.
I used to display code. :)
   Thanks once again.
Edited by: user10641405 on May 21, 2009 2:06 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to make code standardization in oracle 10 in sql/pl-sql

    if any body helps to handle how to make code standaridazation in oracle 10g in sql/pl-sql.

    refer tis link and get download..
    http://www.itap.purdue.edu/ea/data/standards/plsql.cfm

  • How to make use of Table Maintanance Generator?

    PLs sany one can explain me how to maek use of Table maintanance Generator?
    Regards and cheers,
    Giri

    Hi,
        table maintainence Generator is used to manually
        input values using transaction sm30
        follow below steps
       1) go to se11 check table maintanance check box under
          attributes tab
       2) utilities-table maintanance Generator->
          create function group and assign it under
          function group input box.
          also assign authorization group default &NC& .
       3)
        select standard recording routine radio in table
        table mainitainence generator to move table
        contents to quality and production by assigning
        it to request.
       4) select maintaience type as single step.
       5) maintainence screen as system generated numbers
          this dialog box appears when you click on create
         button
        6) save and activate table
       using sm30 you can create entries manually.
    also check below thread to assign transaction code to
    table generator
    /message/240993#240993 [original link is broken]
    0#2409930  
    Regards
    amole

  • How to get similar color for objects in different pictures

    how do you get similar color for objects in different pictures
    I have a prodject that i'm working on and i need to edit several images at once (preferabley) so that they are the same color. They are wooden cupboards and i need all the wood looking the same colour. In light room you can edit a group of images at the same time hence the colours are the same . Is this possible in Elements ? If so how do i do this ?
    I have tried duplicating layers and it just replaces the whole image, it seems to work using levels layers but not the other layers ... I have 30 more images to do and would ideally not like to adjust all the images manually ? I dont mind doing minor tweaks. Essentially all the images where taken with the same camera and lighting and lens's ...
    Screen shot is where I'm at at the moment...
    I have posted this question else where but was told to repost  - this is a link to my previous post as to where we got to
    http://forums.adobe.com/message/4720576#4720576

    You could try using the raw converter. Open one file and edit it (File>Open, pick the image and choose Camera Raw as the format before you click Open). Then open the next image and click the little four-lined square on the upper right side of the ACR window and choose Previous Conversion from the flyout menu.

  • WPF: How to make Tab Header to show three different icons?

    Our WPF application needs Tab header to show three different icons and Foreground.
    If tab is not selected, show one icon and black foreground. If tab is selected, show another icon and white foreground. If tab is selected and also require show Chromestyle, show third icon and red foreground.
    we have tried the following code. However, MultiDataTrigger section does not work.
    <TabItem x:Name="tabItemSetup" Header="Setup">
    <TabItem.HeaderTemplate>
    <DataTemplate>
    <StackPanel Orientation="Vertical">
    <Image x:Name="imgSetup" Height="50" Width="65" Source="Resources/Images/UNSELECTED_Setup Icon.png" DockPanel.Dock="Top" />
    <TextBlock x:Name="txtSetup" Text="{Binding}" Foreground="Black" Style="{StaticResource TabTextStyle}" DockPanel.Dock="Bottom" FontFamily="Eras ITC" FontSize="13.333"/>
    </StackPanel>
    <DataTemplate.Triggers>
    <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" Value="True">
    <Setter TargetName="txtSetup" Property="Foreground" Value="White"/>
    <Setter TargetName="imgSetup" Property="Source" Value="Resources/Images/SELECTED_Setup Icon.png"/>
    </DataTrigger>
    <MultiDataTrigger>
    <MultiDataTrigger.Conditions>
    <Condition Binding="{Binding IsChromeStyle}" Value="True"/>
    <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" Value="True"/>
    </MultiDataTrigger.Conditions>
    <MultiDataTrigger.Setters>
    <Setter TargetName="txtSetup" Property="Foreground" Value="Red"/>
    <Setter TargetName="imgSetup" Property="Source" Value="Resources/Images/Chrome SELECTED_Setup Icon.png"/>
    </MultiDataTrigger.Setters>
    </MultiDataTrigger>
    </DataTemplate.Triggers>
    </DataTemplate>
    </TabItem.HeaderTemplate>
    </TabItem>
    Does anyone know how to make it work? Thx!
    JaneC

    Where is the IsChromeStyle property defined? It is the Header, i.e. the string "Setup" that is the DataContext of the HeaderTemplate and the a string has no property called IsChromeStyle so you must specify a source for the binding.
    If for example the DataContext object of the TabControl, or the parent of the TabControl (for example the window or whatever) has a property called IsChromeStyle you could bind to this one using a RelativeSource:
    <MultiDataTrigger.Conditions>
    <Condition Binding="{Binding DataContext.IsChromeStyle, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="True"/>
    <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" Value="True"/>
    </MultiDataTrigger.Conditions>
    Then it should work. It is the binding that fails.
    Please remember to close your threads by marking helpful posts as answer.

  • How to make use of the presentation variable in SQL result query

    I have 2 prompts in my dashboard.
    Prompt1 decides the values of Prompt2.
    I have set a presentation Variable (selected_comp) in prompt1 which holds the value selected.
    To populate the values for Prompt2, I need to execute a query using the presenation variable set by Prompt1.
    SELECT "List Of Values".RID from rocketv2_3 WHERE "List Of Values".NAME='COMPONENT' AND "List Of Values".VAL=@{selected_comp}
    the query is resulting into
    SQL Issued: SELECT "List Of Values".RID from rocketv2_3 WHERE "List Of Values".NAME='COMPONENT' AND "List Of Values".VAL=0
    but the value in selected_comp is "ABC".
    Can anybody help in how to make use of the presentation variable in query to get the correct value
    thanks
    Shubha

    Just use constrain check box to filter your 2nd prompt values based on the 1st prompt.
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • How Configuring Channel to use Mail Event Generator with a "String" Message

    Hello,
    I would like use a Mail Event Generator to receive String message.
    The BEA example is :
              <channel name ="SampleEGEmailChannel" messageType="xml"           qualifiedMessageType="oagpo:PROCESS_PO_007"           qualifiedMetadataType="eg:EmailEventGenerator"/>
    How change this example to accept messageType="string" ?
    Thanks for your help !!

    Thank you for your help :-)
    In fact I try to use messageType="string" and try to remove the qualifiedMessageType (but to uses Email Generator you must keep qualifiedMetadataType attributes ) and It has not worked.
    Why ? Because I haven't restarted the server.
    Conclusion: When you have problem, think to restart integration server !!

  • How to make a button to search something in sql

    I am trying to make a button that can search for something like for example if like say i type yes, it will show me things that is under yes.But I am not sure how to make the code work as I cannot change the php code as it is under the requirement that I make the button work and not using the php code to make it work which means that I cannot type the yes to show the information and the button must somehow have the "yes" in the function to show the information.Please help me and Thanks for your help.
    This is my flash code.
    package  {
      import flash.display.MovieClip;
      import flash.net.NetConnection;
      import flash.net.Responder;
      import flash.events.MouseEvent;
      public class main extends MovieClip {
      var gateway:NetConnection;
      var responder:Responder;
      public function main() {
      gateway = new NetConnection();
      gateway.connect("http://localhost:8088/amfphp/gateway.php");
      responder = new Responder(OnPass,OnError);
      showAlBtn.addEventListener(MouseEvent.CLICK,doAvailable);
      function doAvailable(evt:MouseEvent):void
      gateway.call("Books.getBooksAvailable",responder);
      function OnPass(res:Object):void
       var i:int;
      albumDG.removeAll();
      for (i=0;i<res.length;i++)
      albumDG.addItem(res[i]);
      function OnError(res:Object):void
      trace("Error");
    .This is the code for the php code that works because I already tested it out because it allows me to type yes and it shows me the required information that I need and it is not tested on flash cs6 but on local host things that allows me to test it out.
    function getBooksAvailable($avail)
      $this->connect();
      $sql = "SELECT title as 'Book Title', author as 'Author', price as 'Price', available as 'Available'
      FROM tblbookinventory
      WHERE available ='" . $avail . "'";
      $result = mysql_query($sql, $this->_connection);
      $rows = array();
      while($row = mysql_fetch_array($result, MYSQL_ASSOC))
      array_push($rows, $row);
      return $rows;

    use the urlloader class to call your php file. 
    the php function you showed is expecting a variable ($avail)  that might accept a value of 'yes'.

  • How to make a http request from a pl/sql procedure(URGENT)

    I need to make a http request from a pl/sql procedure, can any one tell me which built-in package and which procedure/function we serve my need?
    Thanks in advance.
    Ram Prasad.

    You should use UTL_HTTP package, but before it install the JVM into DB

  • How to make similar text that's in the picture

    How can I make text similar in design and layout of the below picture.  In PS I was able to crop the camera and make adjustments.
    thanks
    Mike

    Hey Mike, have you tried What the Font yet?
    http://new.myfonts.com/WhatTheFont/
    I found it can help now and again but your design doesn't look like a standard font to me. You might want to think about tracing it with the good old pen tool.
    Jeff

  • WPF: How to make the first column does not show row separator and Left column separator in DataGrid?

    Our WPF application uses DataGrid.
    One of request is that first column of DataGrid does not show row separator and also does not show Left column separator. So it looks like the first column does not belong to the DataGrid. However, when select a row, the cell of first column still get selected.
    How do we make it? Thx!
    JaneC

    Hi Magnus,
    Thanks for replying our question and provide your solution!
    Your solution works by setting "HorizontalGridLinesBrush" and "VerticalGridLinesBrush" to {x:Null} in the DataGrid style and modify "CellStyle" in first column as following:
    <DataGridTextColumn MinWidth="32"
    Binding="{Binding CellName}"
    CanUserReorder="False"
    CanUserSort="False"
    Header="Cell}"
    IsReadOnly="true" >
    <DataGridTextColumn.CellStyle>
    <Style TargetType="DataGridCell">
    <Setter Property="IsEnabled" Value="False"></Setter>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridCell}">
    <Border BorderThickness="0" BorderBrush="{x:Null}"
    Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Margin="-1">
    <Grid Background="{TemplateBinding Background}" VerticalAlignment="Center" Height="42">
    <ContentPresenter VerticalAlignment="Center"/>
    </Grid>
    </Border>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    </DataGridTextColumn.CellStyle>
    </DataGridTextColumn>
    We found another way to achieve it by using DataGridRowHeader. The good way to use DataGridRowHeader is that we do not need to make the first column ReadOnly (click on first column does not select whole row anymore). Select RowHeader in a row will select
    whole row. Move scroll bar horizontally, the row header still keep in visible area.
    <Style TargetType="{x:Type DataGridRowHeader}" x:Key="dataGridRowHeaderStyle">
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalAlignment" Value="Center" />
    <Setter Property="Height" Value="42" />
    <Setter Property="SeparatorBrush" Value="{x:Null}" />
    <Setter Property="FontSize" Value="16" />
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
    <Grid>
    <Border x:Name="rowHeaderBorder"
    BorderThickness="0"
    Padding="3,0,3,0"
    Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
    BorderBrush="{x:Null}">
    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
    </Border>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    <DataGrid>
    <DataGrid.RowHeaderStyle>
    <Style TargetType="DataGridRowHeader" BasedOn="{StaticResource dataGridRowHeaderStyle}">
    <Setter Property="Content" Value="{Binding CellName}" />
    <Setter Property="Width" Value="35"/>
    </Style>
    </DataGrid.RowHeaderStyle>
    </<DataGrid>
    JaneC

  • How to make an action that does not record the path in which you save your file

    Hi all, once I set an action like this:
    and with the batch i can always choose the destination folder, time by time.
    But I tried to do a similar action that saves a png file, but I can't leave the "in: " empty, it always fill with a path.
    How can I do?
    Thanks a lot!

    Basically i need to create a new document out of a folder full of images.
    You may have to look into Scripting to achieve something like this.
    You could ask in the Scriptimg Forum
    Photoshop Scripting
    But maybe it would suffice to insert the Menu Item
    File – Scripts – Load Files into Stack
    into the Action and then iterate through the Layers with [ or ] and reset the opacities and Blend Modes – but as Actions would not be able to change the number of repetitions of the operation conditionally a custom Script would still seem preferable. 

  • How to make DV file that does not need audio rendering

    Hi,
    I use MPEG Streamclip to convert video-footage captured on DVD (Sony camcorder) to DV format for compatibility with FCE.
    I use export to DV, PAL 25, 16:9 setting etc. Video works perfectly in FCE (e.g. video plays in canvas) with right aspect ratio but the sound just give the beeps.
    The difference between the project settings and the video clip setting (inside FCE) is the following:
    Audio: 2 outputs (clip shows "1 stereo")
    Aud rate: 48.0 KHz (same for clip)
    Aud format: 32-bit Floating Point (same for clip).
    So the difference seems to be that the DV file contains one stereo stream whereas the project needs two separate streams. However, when I add the clip to the time-line it distributes the stereo-stream over the two channels but I need to render before I can hear the footage.
    Is there any way that I can create a more compatible DV using MPEG Streamclip or some other software? Or is there a way to handle this easy in the FCE project setup?
    Thanks
    Troels

    Hi Tom.
    That does the trick - audio is now playing unrendered also. When choosing DV-PAL anamorphic preset it seems to check to flag automatically inside FCE although now the "preview" of the video in Quicktime shows up in 4:3. I did set the options setting in MPEG Streamclip to 16:9 but it seems you cannot have it all.
    Thanks
    Troels

  • How to make list show up "selectively" on different regions?

    Hi,
    By default, "list" is in the Shared Component.
    Is there any way I can make the "list" NOT shared? Meaning that I want to control which "regions" the particular "lists" will show up or not.
    For example:
    On my APEX Home page, I want to have 5 Forms (Form1-From5) for the user to select from. And each Form contains 3 sub-forms: New Entry, Update and Delete.
    So on the Home page, I defined 5 regions (for Form1 - From5), and within each region, I have 3 "lists" for New Entry, Update and Delete and in turn each list calls appropriate form to perform "New Entry", "Update" or "Delete" accordingly. It looks something like the following:
    Form1
    Form1NewEntry Form1Update Form1Delete
    Form2
    Form2NewEntry Form2Update Form2Delete
    and so forth.
    However, since the "list" is shared components, whatever lists that I define in Form1 show up THROUGHOUT ALL 5 forms, that is "Form1NewEntry" and "Form1Update" and "Form1Delete", which is NOT what I want. Is there a way I can use "Condition" to make the "lists" show up in "region" (NOT page) selectively? And how (since there are MANY options in the "Conditions")?
    Or if not, could you suggest the alternative way of doing it? (ie: Form1 -> subformNewEntry
    -> subformUpdate
    -> subformDelete)
    I have an important demo coming up shortly. And this is our FIRST Apex application in the company to show its usability.
    Greatly appreciated,
    Helen

    I have a similar requirement. I have several tabs (Operations, Maintenance, Safety, etc.) and users get individually assigned rights. I have a table where I have all the users listed and I added one column for each tab so I can set whether or not that user has access to that tab. You could go the same thing with groups if you want.
    Basically, my table looks like this:
    USER_ID, USER_NM, PWD_HASH, SAFETY_TAB, MAINT_TAB, OPER_TAB, etc.
    where each of the _TAB fields is set up as a VARCHAR2(2) for just Y/N.
    On my home page, I assign an APPLICATION_ITEM called G_USER_ID (Global User ID) on login so I can track who it is. Then I set the condition statement on the tab to SQL QUERY RETURNS AT LEAST ONE ROW
    using the following query:
    select SAFETY_TAB from APEX_USERS
    where SAFETY_TAB = 'Y'
      and USER_ID = :G_USER_IDThis example would be for the Safety tab, but you can easily substitute others. It works pretty slick.

  • How to make a cell in JTable a different colour?

    Hi, i've been playing with JTables with a custom CellRenderer, which I'm trying to make so that in the JTable, when two values down a column are found to be the same, the back ground colour changes to something same (hoping that there is a way to randomize the colour values) the code i have atm is
    In the main program :
                        find.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent ae) {
                                  datahome = cC.data;
                                  TableColumnModel colModel = cC.jtable.getColumnModel();
                                  TableColumn column = colModel.getColumn(0);
                                  column.setCellRenderer(new RedCellRenderer(new int[] {1,2}));
    in the cellrenderer:
    package packageSolo;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.*;
    import java.awt.*;
    public class SetCellColour extends DefaultTableCellRenderer {
         private int arrVerifyColumns[] = null;
         public SetCellColour(int iTestColumns[]) {
              arrVerifyColumns = iTestColumns;
         public Component getTableCellRendererComponent(JTable table, Object value,
                   boolean isSelected, boolean hasFocus, int row, int column) {
              this.setBackground(Color.RED); // All columns verified were empty - set
              // our background RED
              return this;
    }any my problem is that this cellrenderer will change the column and not just the cell, i've tried to pass where the cell is (the x and y of the cell) to the cellrenderer, but there is no way for me to interpret this value in cellrenderer and set that cell to that colour i'm not sure if there is a cell model instead of column model and be able to pass that onto the cellrenderer

    ell after several tries, i have determined that it may be something wrong with that my jtable is part of a JPanel, that is attached to a container with scroll pane that is then added to a JFrame's center... and somewhere here it freezes the display...
    my code for the actual JFrame:
    package packageSolo;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class ConflictCheckerGUIIntialization extends JFrame {
          * debugger
          * @param x
          *            takes in an int and prints a debug line when enabled to the
          *            console
         private void debug(int x) {
              // System.out.print("Flag: "+ x);
         private static int flag1 = 0;
         private static int flag2 = 0;
         private static int flag3 = 0;
         private static int flag4 = 0;
         private static int flag5 = 0;
         private static int flag6 = 0;
         private static int flag7 = 0;
         private static int flag8 = 0;
         private static int flag9 = 0;
         private Object[][] datahome;
         private JButton cConflict = new JButton("Check Conflict");
         private JButton find = new JButton("Find");
         private JButton quit = new JButton("Exit");
         // private JButton northavg = new JButton("North's Average");
         // private JButton eastavg = new JButton("East's Average");
         // private JButton largest = new JButton("Largest Percepitation");
         // private JButton totalPercepitation = new JButton("Total Percepitation");
         private ConflictCheckerGUI cC = new ConflictCheckerGUI();
         private JFrame jf = new JFrame();
         private JFrame jf1 = new JFrame();
         // Get the size of the default screen
         private static Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
         private int screensizex = (int) (dim.width * 0.8);
         private int screensizey = (int) (dim.height * 0.75);
         private static int gcsizex = (int) (dim.width * 0.625);
         private static int gcsizey = (int) (dim.height * 0.1953125);
         private static GUIConsole gc = new GUIConsole("Output", gcsizex, gcsizey);
         public ConflictCheckerGUIIntialization() {
              boolean RunOnce = false;
              while (RunOnce == false) {
                   if (cC.finished == true) {
                        System.out.println("he");
                        Container c1 = jf.getContentPane();
                        c1.setLayout(new FlowLayout());
                        Container c = this.getContentPane();
                        Container c2 = jf1.getContentPane();
                        JPanel jp = new JPanel();
                        jp.add(cC);
                        cConflict.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent ae) {
                                  datahome = cC.data;
                                  // System.out.print(datahome
                                  // [0][0].toString().compareTo(datahome
                                  // [1][0].toString()));
                                  // System.out.print(datahome
                                  // [0][0].toString().equals(datahome
                                  // [1][0].toString()));
                                  for (int conflictCounter2 = 1; conflictCounter2 < 3; conflictCounter2++) {
                                       int conflictCounter4 = 0;
                                       for (int conflictCounter1 = 0; conflictCounter1 <= cC.Classroomint; conflictCounter1++) {
                                            conflictCounter4++;
                                            for (int conflictCounter3 = 1; conflictCounter3 <= (cC.Classroomint - conflictCounter4); conflictCounter3++) {
                                                 if (datahome[conflictCounter2][conflictCounter1]
                                                           .toString()
                                                           .equals(
                                                                     datahome[conflictCounter2][conflictCounter1
                                                                               + conflictCounter3]
                                                                               .toString())) {
                                                      System.out.println("error at "
                                                                + conflictCounter2 + " "
                                                                + conflictCounter1);
                                   * for (int counter1 = 0; counter1 < pg.monthint;
                                   * counter1++) { for (int counter2 = 0; counter2 < 5;
                                   * counter2++) {
                                   * System.out.print(datahome[counter1][counter2] +
                                   * "\t"); } System.out.println(); }
                        quit.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent ae) {
                                  try {
                                       System.exit(0);
                                  } catch (SecurityException ea) {
                                       System.out.println("Cannot exit");
                        find.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent ae) {
                                  datahome = cC.data;
                                  Object value = null;
                                  cC.jtable.getCellRenderer(0, 0)
                                            .getTableCellRendererComponent(cC.jtable,
                                                      value, false, true, 0, 0).setFont(new Font(
                                                      "Serif", Font.BOLD, 14));
                                  System.out.println(cC.data[0][0].toString());
                                  // .setFont(new Font("serif", Font.BOLD, 12));
                        gc
                                  .println("There is a known bug with this program that if you enter any information in the table,");
                        gc
                                  .println("then not confirming it by not going to another cell, then the data you've entered it not valid and not considered to be input,");
                        gc
                                  .println("this will be fixed in future revisions if possible");
                        gc.show();
                        gc.setLocation(0, screensizey);
                                    *bold*
                                   *bold* c2.add(jp, "Center");
                        *bold*c2.add(new JScrollPane(jp,
                                  *bold*ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                                  *bold*ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED),
                                  *bold*"Center");
                        c1.setLayout(new GridLayout(2, 5));
                        c1.add(cConflict);
                        c1.add(find);
                        c1.add(quit);
                        c1.setVisible(true);
                        c2.setVisible(true);
                        c.add(c1, "South");
                        c.add(c2, "Center");
                        c.setVisible(true);
                        this.pack();
                        this.setTitle("Lancer's Class Conflict Checker");
                        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
                        this.setSize(screensizex, screensizey);
                        RunOnce = true;
                        // ! this.pack(); //this tries to set the size of the thing to a
                        // perferred size, and if used will not alow the dynamic sizing
                        // of
                        // the
                        // main JTable window based on the user's screensize
         public static void main(String[] args) {
              ConflictCheckerGUIIntialization x = new ConflictCheckerGUIIntialization();
              x.setVisible(true);
    }here, the JPanel with the jtable is added to c2 and c2 is added to c and c's parent is the JFrame of this whole class
    and the code for the jtable JPanel is:
    package packageSolo;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import java.io.FileNotFoundException;
    import javax.swing.*;
    import javax.swing.table.*;
    public class ConflictCheckerGUI extends JPanel {
         private void debug(int x) {
              // System.out.println(x);
         protected static boolean finished = false;
         protected static DefaultTableModel[][] data;
         protected static int Classroomint = 0;
         protected static JTable jtable;
         protected static String[] columnNames = { "Classroom", "Period One",
                   "Period Two", "Period Three", "Period Four" };
         protected static int GoAheadFlag = 0;
         SetCellColour renderer;
         public ConflictCheckerGUI() {
              // super(new GridLayout(1, 0));
              JFrame Choose = new JFrame();
              Choose.setDefaultCloseOperation(Choose.EXIT_ON_CLOSE);
              JButton ImportFromFile = new JButton("Impoort From File");
              JButton New = new JButton("New Planner");
              ImportFromFile.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent ae) {
                        String[] North;
                        String[] East;
                        String[] South;
                        String[] West;
                        String[] Month;
                        // JFileChooser fc = new JFileChooser();
                        // fc.show();
                        // int returnVal = fc.showOpenDialog(fc);
                        // File file = null;
                        // if (returnVal == JFileChooser.APPROVE_OPTION) {
                        // file = fc.getSelectedFile();
                        java.util.Scanner parse = null;
                        File file = new File(
                                  "E://Documents and Settings//TheHolyLancer//My Documents//java - old//Eclipse workspace//Precipitation//packageSolo//datasave.txt");
                        try {
                             parse = new java.util.Scanner(file);
                        } catch (FileNotFoundException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                        Classroomint = Integer.parseInt(parse.next());
                        North = new String[Classroomint];
                        East = new String[Classroomint];
                        South = new String[Classroomint];
                        West = new String[Classroomint];
                        Month = new String[Classroomint];
                        for (int counter1 = 0; counter1 < Classroomint; counter1++) {
                             Month[counter1] = "n/a";
                        for (int counter2 = 0; counter2 < Classroomint; counter2++) {
                             North[counter2] = "n/a";
                             East[counter2] = "n/a";
                             South[counter2] = "n/a";
                             West[counter2] = "n/a";
                        data = new DefaultTableModel[Classroomint][5];
                        jtable = new JTable(new DefaultTableModel(Classroomint,5));//columnnames
                        jtable.setPreferredScrollableViewportSize(new Dimension(800,
                                  600));
                        finished = true;
              New.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent ae) {
                        String input;
                        String[] North;
                        String[] East;
                        String[] South;
                        String[] West;
                        String[] Month;
                        int flag2 = 0;
                        int flag4 = 0;
                        int flag5 = 0;
                        int flag8 = 0;
                        input = JOptionPane
                                  .showInputDialog("How many classromms are there?");
                         * see if the user wantes to quit at this point
                        if (input == null) {
                             debug(4);
                             int exitint = 0;
                             exitint = JOptionPane.showConfirmDialog(null,
                                       "Do you want to exit?", "Exit?",
                                       JOptionPane.OK_CANCEL_OPTION);
                             if (exitint == 0) {
                                  try {
                                       System.exit(1);
                                  } catch (SecurityException eb) {
                                       System.out.println("exit");
                        while (flag4 == 0) {
                              * this while loop with flag2 is for checking if the thing
                              * is of int class
                             while (flag2 == 0) {
                                   * try to get a integer, check for a bad input class
                                  try {
                                        * parse, and if success set flag2 to 1 and break
                                        * out this while loop
                                       Classroomint = Integer.parseInt(input);
                                       flag2 = 1;
                                       debug(2);
                                  } catch (NumberFormatException ec) {
                                       debug(3);
                                        * ops user input was not a integer class
                                       JOptionPane.showMessageDialog(null,
                                                 "Enter a positive integer only",
                                                 "Number Format is Wrong",
                                                 JOptionPane.ERROR_MESSAGE);
                                       input = JOptionPane
                                                 .showInputDialog("How many months are there?");
                                        * see if the user wantes to quit at this point
                                       if (input == null) {
                                            debug(4);
                                            int exitint = 0;
                                            exitint = JOptionPane.showConfirmDialog(null,
                                                      "Do you want to exit?", "Exit?",
                                                      JOptionPane.OK_CANCEL_OPTION);
                                            if (exitint == 0) {
                                                 try {
                                                      System.exit(1);
                                                 } catch (SecurityException eb) {
                                                      System.out.println("exit");
                              * this while loop sees if the integer is smaller than 0 so
                              * the array cannot be a real one
                             while (flag5 == 0) {
                                  // numamountint = Integer.parseInt(numamount);
                                  if (Classroomint < 0) {
                                       debug(5);
                                       JOptionPane.showMessageDialog(null,
                                                 "Enter a positive integer",
                                                 "Number Format/Size is Wrong",
                                                 JOptionPane.ERROR_MESSAGE);
                                       input = JOptionPane
                                                 .showInputDialog("How many months are there?");
                                       if (input == null) {
                                            int exitint = 0;
                                            exitint = JOptionPane.showConfirmDialog(null,
                                                      "Do you want to exit?", "Exit?",
                                                      JOptionPane.OK_CANCEL_OPTION);
                                            if (exitint == 0) {
                                                 try {
                                                      System.exit(1);
                                                 } catch (SecurityException eb) {
                                                      System.out.println("exit");
                                        * this while loop check for number format again
                                       while (flag8 == 0) {
                                            try {
                                                 debug(6);
                                                 Classroomint = Integer.parseInt(input);
                                                 flag8 = 1;
                                            } catch (NumberFormatException ec) {
                                                 debug(7);
                                                 JOptionPane.showMessageDialog(null,
                                                           "Enter a positive integer only",
                                                           "Number Format is Wrong",
                                                           JOptionPane.ERROR_MESSAGE);
                                                 input = JOptionPane
                                                           .showInputDialog("How many months are there?");
                                                 if (input == null) {
                                                      int exitint = 0;
                                                      exitint = JOptionPane
                                                                .showConfirmDialog(
                                                                          null,
                                                                          "Do you want to exit?",
                                                                          "Exit?",
                                                                          JOptionPane.OK_CANCEL_OPTION);
                                                      if (exitint == 0) {
                                                           try {
                                                                System.exit(1);
                                                           } catch (SecurityException eb) {
                                                                System.out.println("exit");
                                  } else {
                                        * here the input is greater than 0 so it sets flag5
                                        * and 4 then break out of the while loops
                                       debug(8);
                                       flag5 = 1;
                                       flag4 = 1;
                        North = new String[Classroomint];
                        East = new String[Classroomint];
                        South = new String[Classroomint];
                        West = new String[Classroomint];
                        Month = new String[Classroomint];
                        for (int counter1 = 0; counter1 < Classroomint; counter1++) {
                             Month[counter1] = "n/a";
                        for (int counter2 = 0; counter2 < Classroomint; counter2++) {
                             North[counter2] = "n/a";
                             East[counter2] = "n/a";
                             South[counter2] = "n/a";
                             West[counter2] = "n/a";
                        DefaultTableModel tableModel = new DefaultTableModel(Classroomint, 0);
                        tableModel.addColumn("Classroom");
                        tableModel.addColumn("Period One");
                        tableModel.addColumn("Period Two");
                        tableModel.addColumn("Period Three");
                        tableModel.addColumn("Period Four");
                        /*protected static String[] columnNames = { "Classroom", "Period One",
                             "Period Two", "Period Three", "Period Four" };*/
                        // /jtable = new JTable(data, columnNames);
                        jtable = new JTable(tableModel) {
                             private static final long serialVersionUID = 1L;
                             public TableCellRenderer getCellRenderer(int row, int col) {
                                  return renderer;
                        jtable.setRowSelectionAllowed(true);
                        jtable.setPreferredScrollableViewportSize(new Dimension(800,
                                  600));
                        finished = true;
              Container ButtonHolder = new Container();
              ButtonHolder.setLayout(new GridLayout(1, 2));
              ButtonHolder.add(New);
              ButtonHolder.add(ImportFromFile);
              Choose.add(ButtonHolder);
              Choose.setSize(200, 300);
              Choose.setVisible(true);
              boolean RunOnce = false;
              while (RunOnce == false) {
                   if (finished == true) {
                        //JScrollPane scrollPane = new JScrollPane(jtable);
                        this.add( jtable, BorderLayout.CENTER );
                        Choose.setEnabled(false);
                        RunOnce = true;
    }but upon start, and select start new table, the windows come up, but on where the large JFrame is and where the jtable is, nothing appears, and it acts like a screen cap and the thing just stucks like what is on the background of the computer... i think in all this linking i may have screwed something up, and the examples given were not designed for JPanels, but rather for JFrames... maybe i could implement all this into one class, since the buttons for choosing from load from file and all that can be in the first file as another JFrame, that is first visible, then when user chose one, something becomes visible, or something
    but anyone knows how to fix all this?

Maybe you are looking for