1 返信 最新の回答 日時: Sep 1, 2014 1:19 PM ユーザー:ORA-00904

    Coloring bean area in Oracle forms

    ORA-00904

      Hello,

       

      to color different areas of an bean area I have created a Java bean. In my data block I add tvo bean areas referencing same bean area. Whout I would like to achieve is to color each field differently. My code is now color all fields with same color. Like I am working with same instance of object.

       

      I draw images in paint method:

       

      public void paint(Graphics g) {
        
          try {
              super.paintComponents(g);
              if (_Occupation != null && !_Occupation.isEmpty() && _FieldHeight > 0
                      ) {
                  int NumberOfCells = _Occupation.length();
                 
                  int RectHeight = _FieldHeight / NumberOfCells;

       

                 
                  String[] StartColorBusy = getRGB(_StartColorBusy);
                  String[] EndColorBusy = getRGB(_EndColorBusy);
                  String[] StartColorFree = getRGB(_StartColorFree);
                  String[] EndColorFree = getRGB(_EndColorFree);
                  String[] StartColorThirdState = getRGB(_StartColorThirdState);
                  String[] EndColorThirdState = getRGB(_EndColorThirdState);
                  String[] Occupation = _Occupation.split("");
                  Graphics2D g2 = (Graphics2D) g;

       

                  int y = 0;
                  //Za vsako celico narišemo kvadrat in ga pobarvamo z ustrezno barvo
                  for (int i = 1; i <= NumberOfCells; i = i + 1) {
                      //Nastavimo barvo glede na zasedenost ali ne
                      if (Occupation[i].equals("1")) {
                          //g.setColor(new Color(Integer.parseInt(StartColorBusy[0]), Integer.parseInt(StartColorBusy[1]), Integer.parseInt(StartColorBusy[2])));
                          Color start_color = new Color(Integer.parseInt(StartColorBusy[0]), Integer.parseInt(StartColorBusy[1]), Integer.parseInt(StartColorBusy[2]));
                          Color end_color = new Color(Integer.parseInt(EndColorBusy[0]), Integer.parseInt(EndColorBusy[1]), Integer.parseInt(EndColorBusy[2]));
                          GradientPaint gp = new GradientPaint(0, 0, start_color, _FieldWidth, RectHeight, end_color);
                          g2.setPaint(gp);
                      } else if (Occupation[i].equals("2")) {
                          //g.setColor(new Color(Integer.parseInt(ColorThirdState[0]), Integer.parseInt(ColorThirdState[1]), Integer.parseInt(ColorThirdState[2])));
                          Color start_color = new Color(Integer.parseInt(StartColorThirdState[0]), Integer.parseInt(StartColorThirdState[1]), Integer.parseInt(StartColorThirdState[2]));
                          Color end_color = new Color(Integer.parseInt(EndColorThirdState[0]), Integer.parseInt(EndColorThirdState[1]), Integer.parseInt(EndColorThirdState[2]));
                          GradientPaint gp = new GradientPaint(0, 0, start_color, _FieldWidth, RectHeight, end_color);
                          g2.setPaint(gp);
                      } else {
                          //g.setColor(new Color(Integer.parseInt(ColorFree[0]), Integer.parseInt(ColorFree[1]), Integer.parseInt(ColorFree[2])));
                          Color start_color = new Color(Integer.parseInt(StartColorFree[0]), Integer.parseInt(StartColorFree[1]), Integer.parseInt(StartColorFree[2]));
                          Color end_color = new Color(Integer.parseInt(EndColorFree[0]), Integer.parseInt(EndColorFree[1]), Integer.parseInt(EndColorFree[2]));
                          GradientPaint gp = new GradientPaint(0, 0, start_color, _FieldWidth, RectHeight, end_color);
                          g2.setPaint(gp);
                      }

       

                      g2.draw(new RoundRectangle2D.Double(0, y,
                              _FieldWidth,
                              RectHeight,
                              0, 0));
                      g2.fill(new Rectangle2D.Double(0, y, _FieldWidth, RectHeight));
                      y = y + RectHeight;
                      repaint();
                  }
                  _executed = true;
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
      }

       

      What I have to do to color each bean area differently?

       

      Regards,

      Igor