Using JPanel in Forte

Is there anyway to save drawings created in the JPanel as .jpeg file or .gif file and print it out? Or can we convert drawings/picture in JPanel into .gif /.jpeg? If can, how to do so?

If you are willing to load the Java Advanced Imaging package from Sun, you can manipulate the files in just about any way you like and save them in just about any format. I use it with some JPG's and some TIFF's.

Similar Messages

  • Problem with compiling STL using program with Forte C++ 6 update 1 in compat mode

    I try to compile SGI STL using program with Forte C++ 6 update 1 and I get an errror
    ld -L/opt/SUNWspro/WS6U1/lib -liostream test.o -o test
    Undefined first referenced
    symbol in file
    __0oNIostream_initctv test.o
    __0oNIostream_initdtv test.o
    Iostream_init - declared as a static class CC4/iostream.h, but nm libiostream.a produce
    __1cNIostream_init2T6M_v_
    __1cNIostream_init2t6M_v_
    and program can't link.
    What's wrong?
    Thank you for any comments

    Hi!
    I experienced the same problem and the solution looks like the following: in sunpro6.mak file there is a variable STL_INCL that has the following value: -I. -I${PWD}/../stlport
    Change that to -I. -I${PWD}/../stlport/SC5 and the problem vanishes. The reason is that stlport/SC5 contains files *.SUNWCCh which are used by SUNpro C++ compiler as standard headers and contain correct STLPort namespace information.
    Regars,
    Art

  • Re: (forte-users) Anyone used Semaphors in Forte ?

    Jean-Paul,
    I'm not sure what behaviour you are trying to implement with semaphores.
    In Forté, the Mutex type is an implementation of a mutual exclusion
    semaphore.
    If that's all you need, then using Mutex would be the smartest way to
    implement a semaphore.
    Is that sufficient or are you looking for some other semaphore flavor?
    Daniel Désy
    BORN.
    ----- Original Message -----
    From: "Jean-Paul Gabrielli" <Jean-Paul.Gabriellisema.fr>
    To: "000Forte-Users" <forte-userslists.xpedior.com>
    Sent: Tuesday, December 19, 2000 7:37 AM
    Subject: (forte-users) Anyone used Semaphors in Forte ?
    Hi,
    Looking for the smartest way to implement semaphrs in Forte.
    Have you experienced such a use ?
    thanks
    j-paul gabrielli
    sema
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a
    new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

    Jean-Paul,
    I'm not sure what behaviour you are trying to implement with semaphores.
    In Fort&eacute;, the Mutex type is an implementation of a mutual exclusion
    semaphore.
    If that's all you need, then using Mutex would be the smartest way to
    implement a semaphore.
    Is that sufficient or are you looking for some other semaphore flavor?
    Daniel D&eacute;sy
    BORN.
    ----- Original Message -----
    From: "Jean-Paul Gabrielli" <Jean-Paul.Gabriellisema.fr>
    To: "000Forte-Users" <forte-userslists.xpedior.com>
    Sent: Tuesday, December 19, 2000 7:37 AM
    Subject: (forte-users) Anyone used Semaphors in Forte ?
    Hi,
    Looking for the smartest way to implement semaphrs in Forte.
    Have you experienced such a use ?
    thanks
    j-paul gabrielli
    sema
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a
    new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

  • Using JPanel with JFrame

    I am using a JFrame to encapsulate my program. I want to have a JPanel inside my JFrame to handle all of my 2d displaying (like fillRect() etc...). I used forte to set this up but I am having problems dispaying on the JPanel. Here is my code:
    here is how I call the function from the main .java file
    I dubuged this and know it works (proof will come later)
    private void Start_ButtonActionPerformed(java.awt.event.ActionEvent evt)
    myDisplay.draw();
    here is my entire JPanel class
    import java.awt.*;
    import javax.swing.*;
    public class Display extends javax.swing.JPanel
    public Display() {
    initComponents();
    public void paintComponent(Graphics g )
    System.out.println("1");
    super.paintComponent(g);
    g.setColor(Color.black);
    g.fillOval(50,10,60,60);
    public void draw()
    System.out.println("1");
    this.repaint(); //i also tried repaint() but it didn't work either
    System.out.println("2");
    private void initComponents()
    setLayout(new java.awt.BorderLayout());
    when I press the start button, 1 and 2 are displayed but 3 isn't. For some reason the repaint() function is not telling the paintComponent function to work. Any help is appreciated.
    Thanks,
    Every_man

    Every_man,
    After doing the super.paintComponent(g); you must use Graphics2D. So you next line should cast your graphics object to a graphics 2D object, like this. Graphics2D g2 = (Graphics2D)g;

  • How do I use JPanel as a leaf in JTree ?

    Hi All,
    I am a bit of a newbie and I've been trying to change the behavior of my application.
    I have a JTree that I now want to change the rendering of a leaf to be a JPanel. The JPanel will have a couple of JButtons and some text and the user can interact with the JButtons. I was successful in creating the JPanel, adding the buttons and then making my own TreeCellRenderer. Everything displays fine, but the user can not interact with the JButtons, whenever I click on a button in the leaf, the whole leaf is highlighted - I suppose I should not be surprised because this is probably behaving just a cell in a JTree should.
    So I searched the forums and used Google and have found several examples of people using JCheckBox as nodes/leaf(s) in a JTree but none with a JPanel as a leaf. I took one of the check box demos from here ( [http://www.coderanch.com/t/330630/Swing-AWT-SWT-JFace/java/add-swing-component-tree]) and then hacked it a bit but am stuck with the following error :
    Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to javax.swing.JPanel
    which is pointing to the line with JPanel temp2 = (JPanel) temp.getUserObject();
    Does anyone have either some code or suggestions to accomplish a leaf as a JPanel with some buttons ?
    Thanks in advance !
    import javax.swing.*;*
    *import javax.swing.tree.*;
    import java.awt.event.*;*
    *import java.awt.*;
    public class treedemo1 extends JFrame {
        public treedemo1() {
            super("TreeDemo");
            setSize(1500, 1500);
            JPanel p = new JPanel();
            p.setLayout(new BorderLayout());
            customLeafPanel cp1 = new customLeafPanel();
            customLeafPanel cp2 = new customLeafPanel();
            customLeafPanel cp3 = new customLeafPanel();
            DefaultMutableTreeNode root = new DefaultMutableTreeNode("Query Results");
            DefaultMutableTreeNode n1 = new DefaultMutableTreeNode(cp1, false);
            DefaultMutableTreeNode n2 = new DefaultMutableTreeNode(cp2, false);
            DefaultMutableTreeNode n3 = new DefaultMutableTreeNode(cp3, false);
            root.add(n1);
            root.add(n2);
            root.add(n3);
            JTree tree = new JTree(root);
            p.add(tree, BorderLayout.NORTH);
            getContentPane().add(p);
            TestRenderer tr = new TestRenderer();
            tree.setEditable(false);
            tree.setCellRenderer(tr);
        public class customLeafPanel extends JPanel {
            public customLeafPanel() {
                JPanel clpPanel = new JPanel();
                JButton helloJButton = new JButton("Hello");
                this.add(helloJButton);
        public class TestRenderer implements TreeCellRenderer {
            transient protected Icon closedIcon;
            transient protected Icon openIcon;
            public TestRenderer() {
            public Component getTreeCellRendererComponent(JTree tree,
                    Object value,
                    boolean selected,
                    boolean expanded,
                    boolean leaf,
                    int row,
                    boolean hasFocus) {
                DefaultMutableTreeNode temp = (DefaultMutableTreeNode) value;
                JPanel temp2 = (JPanel) temp.getUserObject();
                return temp2;
            public void setClosedIcon(Icon newIcon) {
                closedIcon = newIcon;
            public void setOpenIcon(Icon newIcon) {
                openIcon = newIcon;
        public static void main(String args[]) {
            JFrame frame = new treedemo1();
            frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
            frame.pack();
            frame.setVisible(true);
    }

    Thank you TBM and DB for your replies ! Adding TBM's code does indeed fix the JPanel issue and as TBM indicated this does not actually solve my ultimate problem (Can I give you each 1/2 the Duke points?)
    As a newbie, I am still learning and DB pointed out that "You can however interact with an editor". So after reading the suggested tutorials and looking back at the example code that I hacked. I added the cellEditor back in and it WORKS ! Its funny, I deleted that bits of code from the example, assuming the cellEditor allows you to "edit" (ie change), not interact with it (symantics I guess)
    Thanks again guys for pointing this newbie in the right direction. Frankly I am somewhat surprised that I could finally begin to read and understand what the tutorial and suggestions are telling me ! What is one step up from a newbie ?
    unfortunately I can not post the code because the length of the message is > 5000 :(

  • JTable text alignment issues when using JPanel as custom TableCellRenderer

    Hi there,
    I'm having some difficulty with text alignment/border issues when using a custom TableCellRenderer. I'm using a JPanel with GroupLayout (although I've also tried others like FlowLayout), and I can't seem to get label text within the JPanel to align properly with the other cells in the table. The text inside my 'panel' cell is shifted downward. If I use the code from the DefaultTableCellRenderer to set the border when the cell receives focus, the problem gets worse as the text shifts when the new border is applied to the panel upon cell selection. Here's an SSCCE to demonstrate:
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.EventQueue;
    import javax.swing.GroupLayout;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.border.Border;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import sun.swing.DefaultLookup;
    public class TableCellPanelTest extends JFrame {
      private class PanelRenderer extends JPanel implements TableCellRenderer {
        private JLabel label = new JLabel();
        public PanelRenderer() {
          GroupLayout layout = new GroupLayout(this);
          layout.setHorizontalGroup(layout.createParallelGroup().addComponent(label));
          layout.setVerticalGroup(layout.createParallelGroup().addComponent(label));
          setLayout(layout);
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
          if (isSelected) {
            setBackground(table.getSelectionBackground());
          } else {
            setBackground(table.getBackground());
          // Border section taken from DefaultTableCellRenderer
          if (hasFocus) {
            Border border = null;
            if (isSelected) {
              border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder");
            if (border == null) {
              border = DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder");
            setBorder(border);
            if (!isSelected && table.isCellEditable(row, column)) {
              Color col;
              col = DefaultLookup.getColor(this, ui, "Table.focusCellForeground");
              if (col != null) {
                super.setForeground(col);
              col = DefaultLookup.getColor(this, ui, "Table.focusCellBackground");
              if (col != null) {
                super.setBackground(col);
          } else {
            setBorder(null /*getNoFocusBorder()*/);
          // Set up our label
          label.setText(value.toString());
          label.setFont(table.getFont());
          return this;
      public TableCellPanelTest() {
        JTable table = new JTable(new Integer[][]{{1, 2, 3}, {4, 5, 6}}, new String[]{"A", "B", "C"});
        // set up a custom renderer on the first column
        TableColumn firstColumn = table.getColumnModel().getColumn(0);
        firstColumn.setCellRenderer(new PanelRenderer());
        getContentPane().add(table);
        pack();
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() {
            new TableCellPanelTest().setVisible(true);
    }There are basically two problems:
    1) When first run, the text in the custom renderer column is shifted downward slightly.
    2) Once a cell in the column is selected, it shifts down even farther.
    I'd really appreciate any help in figuring out what's up!
    Thanks!

    1) LayoutManagers need to take the border into account so the label is placed at (1,1) while labels just start at (0,0) of the cell rect. Also the layout manager tend not to shrink component below their minimum size. Setting the labels minimum size to (0,0) seems to get the same effect in your example. Doing the same for maximum size helps if you set the row height for the JTable larger. Easier might be to use BorderLayout which ignores min/max for center (and min/max height for west/east, etc).
    2) DefaultTableCellRenderer uses a 1px border if the UI no focus border is null, you don't.
    3) Include a setDefaultCloseOperation is a SSCCE please. I think I've got a hunderd test programs running now :P.

  • Using JPanel in Word - Help

    Hi,
    I'm trying to insert a JPanel based ActiveX into Words documents, I've used the Sun example (http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html) but it doesn't work.
    When I try to insert the JellyBean exemple in a Word document, Word systematicaly freeze.
    I don't understand, the ActiveX component works fine in VB 6.0 and in the ActiveX Control Test Container.
    What I do :
    1 - Compile JellyBean
    2 - Jar it with a Manifest telling that it's a javabean
    3 - Register it with the packager
    4 - Run Word
    5 - In the Component Tool bar, I choose "Other Controls" and select my component
    => At this moment the sandglass appears and nothing else happens
    My environement :
    SDK : 1.4.2_04
    Visual C++ 6.0
    Windows 2000 Pro
    Any help will be greatly appreciated.
    Olivier
    PS: I've tryed to use SDK 1.3.1 and the old packager but this is worse => Word crash when I insert the component...

    I've found a solution but it doesn't satisfy me plainly ...
    With visual basic, I've embedded the component generated by ActiveX Bridge into an OCX.
    Doing this I'm able to insert the component in an office document but it isn't refreshed (Only a grey box is displayed). To refresh it, I call the activate method on the component in a VBA script.
    Does anyone knows a more simple way to do the stuff ?
    Olivier

  • How can i set  picture as background using JPanel

    hello can you kindly tell me how i can set picture as the background of my jpanel instead of using set
    setBackground(Color.bule)

    you can use a JLayeredPane ; put a JPanel containing a JLabel based on an ImageIcon on the lowest layer of your JLayeredPane
    then, use upper layers to add components
    edit: another possibility is to override the "paint()" method of your JPanel container, and use drawImage() to paint the picture as a background

  • Display image using JPanel

    i have got buffered image from webcam using jmf. i want to display it on JPanel.
    i override paint() but it doesn't display as it captures
    when i maximize window it then displays
    urgent help needed

    The bounds of your JPanel may be incorrect. You should try the setBounds(int x, int y, int width, int height) method on it.
    Please past your code for more help :p

  • Why doesn't the Card show up from the CardLayout:used JPanel,JFrame

    hello guys,
    this is a question regarding. As I did not get nice responses i am posting again today.
    http://forum.java.sun.com/thread.jsp?forum=57&thread=235761
    Hi, I would like to re-arrange my question and put it in a simpler way. I have a frame(mainframes.java) with border layout. There is a panel on the west(borderlayout.west) which has a few buttons. The center panel(borderlayout.center) has a cardlayout and needless to mention that it contains a deck of panels. When I click on a button in the left panel, an appropriate panel in the deck should be displayed in the center panel. It's all simple so far, but here comes the real problem. I have designed my application in such a way that I have each of my panels in a separate class(each of which extend JPanel) and I am trying to integrate them all in my frame. When I click on the button on the left panel(p.s.:this panel is also in a separate class), then the appropriate panel should be displayed in the frame(i.e. in the center deck).
    mainframes.java:-
    //This is the local method which takes an argument from the invoking panel and displays the corresponding card in the deck.
    void showpanel(String p1)
    this.cardLayout2.show(CENTERPANEL,p1);
    System.out.println("Inside showpanel "+ p1);
    leftpanel.java:-
    void B_LOGIN_actionPerformed(ActionEvent e) {
    new mainframes().showpanel("lp");
    // I am trying to display the card "lp" when I click on a button in the leftpanel, but I can only get the console output as "Inside showpanel lp". This shows that the method showpanel(String lp) is getting invoked but the required card is not being displayed. i.e. this.cardLayout2.show(CENTERPANEL,p1) seems to be not working.
    Thanks for your time. Mail me, if you want to access the complete code, at [email protected]

    I'd check to make sure 3 things...
    1) You have added your Panels to the CardLayout Panel
    2) You have added the CardLayoutPanel to the center of your BorderLayout JPanel
    3) Try giving calls to validate()/invalidate() on the JPanel containing the CardLayoutPanel
    void showpanel(String p1)
    ... invalidate()
    this.cardLayout2.show(CENTERPANEL,p1);
    System.out.println("Inside showpanel "+ p1);
    ... validate()
    Otherwise, I may just need to check your source code, you can send to [email protected]

  • Anybody using PGP with Forte for passwords and sensitivedata xfer?

    -Martin

    Using a password as the encryption key is called Password-Based Encryption (PBE).
    You should pass a PBE algorithm to the SecretKeyFactory.getInstance() method, such as "PBEWithMD5AndDES". This tells the secret key factory to hash the password with MD5, before using it as an encryption key (the hashing makes use of all 8 bits AFAIK).
    http://java.sun.com/products/jce/doc/guide/API_users_guide.html#PBE will tell you about PBE and http://java.sun.com/products/jce/doc/guide/API_users_guide.html#PBEEx gives you an example of using PBE.

  • What driver can i use for Auzentech forte 7.1

    - Hello together!
    My Question is, I have the Auzentech Forte 7. Soundcard, and the Orginal Driver for the Card, does not currectly install on my Pc, and the Support Pack 2.0 from Daniel does not work currectly. The Volpanel and the Console will not open. Can i also install SB-X-Fi Series AuzenWDM Pack .0, or is these driver only for Creative cards?
    P.S: Sorry for my bad english, but I hope your german is better!

    Well, it's been more than three weeks now with 0 replies for assistance.  Guess my next move would have to be to try to call Canon by phone and see if they're willing to help sort this out.  Some forums are very responsive.  Here, not so much...
    H

  • Anyone using ObjectBroker with Forte

    Hi there,
    I am attempting to run the Forte provided BNK1 example. I am
    not getting somthing.. My client gets an error(core dump) when I try to
    run. I am just tring to run on the unix server where ObjectBroker is
    installed.. I am not having any luck and FORTE is not even in the loop
    yet.. Can anyone help.. what privilleges do I need?? What env
    variables are needed??
    Thanks in advance,
    Chad

    i created the grub package with patches (its all on the wiki http://wiki.archlinux.org/index.php/Reiser4FShowto) and now im waiting for a brave man to test it...  8)

  • Help using Jpanel

    Hi, can you help me how to display components in a panel?
    I have a container, a scroll panel on the left and a panel on the right. The scroll panel contains a tree. I want that when i click a leaf on a tree, some components would appear on the panel at the right. Each leaf has different components. Can anybody help me how to do this?
    I have here a sample view. Sorry about this, i want to paste the picture of my gui but i can't paste it here.
    +Fruit            |    |
    -Apple | |
    -Orange | |
    -Melon | //unique components will be displayed here |
    -Mango | //for each leaf |
    +sports          |                                                                  |
    -swimming | |
    -basketball | |
    -soccer | |

    Do you know what caused this? You didn't copy the code from the tree demo properly. Compare your code with the "working" code from the tutorial to figure out what you did wrong.
    We are not mind readers. We can't guess what you might have done wrong.

  • How to use a backgroud image in a JPanel.....

    hi,
    How can I display a background image for a JPanel.....
    I have searched this forum but all solutions I found are where JPanel at the end has to be displayed on a frame in an application...
    I need to use JPanel on Applet.......
    Actually I am switching JPanels on JApplet as screens for a game....
    I need to display background image for one of the JPanel class that has to be called by an Applet class....
    Thanks a lot for any help.

    Thanks a lot for your help.
    How do we specify URL to use an image from net. Is itt like I open an image file on some website & use its address? Kindly add here some website too so that its more clear for me.
    Thanks a lot for any help & all help your provided previously.
    String imageFilePath = "urlOfMyImageFile"; // I am asking about parameter to be used here
    ImageIcon ii = new ImageIcon(imageFilePath);
    Image image = ii.getImage();

Maybe you are looking for

  • Hello Word Struts 2.0 Application not working in JDeveloper 10.1.3.2

    Dear All, I have created Hello Word Application in Struts 2.0 in JDeveloper. It gives following Exception: java.net.ProtocolException: Server redirected too many times (20)      at org.apache.commons.digester.Digester.createSAXException(Digester.java

  • Airport Express No Longer Recognized in Airport Utility

    I have an Airport Extreme (version 7.3.2) that I is connected to my cable modem and a pc in my basement. I have an iMac in a separate room on my second floor that accesses the internet wirelessly via the Airport Extreme. I also have an airport expres

  • Acrobat 7.1.0 update halted by fatal error; how to uninstall?

    I've been running Acrobat 7.0.9 on Windows XP with no problems. I just tried to install the 7.1.0 update. When I told it OK to reboot, I got a fatal error in the installation. I rebooted manually, and then got the same fatal error. My PDF files now h

  • Using dynamic text in Flash Builder

    Hi, I'm trying to get some dynamic text to my web page. The text is readed from .txt file I use AS script which i was using in a project I made with Flash Pro and now i try to implement it in Flash Builder project The script look like this: var req:U

  • How to STOP OS X from automatically changing between language input methods

    I want to know if there is a way in OS X Leopard to stop the system from automatically changing the language input method. I use English and Japanese on my computer, but this would apply to anyone using more than one input method. For example, when I