Find Jobs
Hire Freelancers

Applet Redisplay

$30-100 USD

In Progress
Posted about 16 years ago

$30-100 USD

Paid on delivery
Part of my web site requires the need to run an Applet that talks directly to a client device. My applet acquires an image and sends it back to the server. My applet skills are minimal and I would like to contract out development of a specific part of this applet for re-displaying the acquired image and providing the use a button to try again. ## Deliverables All I need for this bid is to see a test applet with a button that will process the actionlistener and redisplay the applet with a new image. The following test applet may be a starting point for you. I can integrate the modified test applet into my web site for testing. If the applet refreshes or redisplays a new image based on an event, then I will be able to integrate this into the real applet in my product. ========================================= package [login to view URL]; import [login to view URL]; import java.applet.*; import java.awt.*; import [login to view URL]; import [login to view URL]; import [login to view URL]; import javax.swing.*; import javax.swing.border.*; import [login to view URL]; import java.awt.event.*; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; public class TestApplet extends JApplet implements ActionListener { private TextField nameField = null; private JButton buttonRetry = null; private JButton buttonSave = null; private JButton imageButton = null; private static String BUTTON_RETRY = "Retry"; private static String BUTTON_SAVE = "Save"; private ImageIcon imageIcon = null; private ImageButton imgButton = null; byte[] readBuf; public TestApplet() throws HeadlessException { super(); } public static void main(String[] args) { } public void destroy() { [login to view URL](); } public void init() { [login to view URL](); try { readBuf = getBytesFromFile(new File("C:\\dfvault\\[login to view URL]")); } catch (Exception e) {} //BufferedImage bufImg = new BufferedImage(readBuf); imageIcon = new ImageIcon(readBuf); imageButton = new JButton(imageIcon); [login to view URL]([login to view URL]); [login to view URL](true); [login to view URL]([login to view URL]([login to view URL])); [login to view URL]([login to view URL]); buttonRetry = new JButton( BUTTON_RETRY ); buttonSave = new JButton( BUTTON_SAVE ); nameField = new TextField("press a button",20); [login to view URL]( this ); [login to view URL]( this ); add(buttonRetry, BorderLayout.PAGE_START); //add(buttonSave, [login to view URL]); add(imageButton, [login to view URL]); add(nameField, BorderLayout.PAGE_END); setVisible(true); } public void actionPerformed( ActionEvent actionEvent ) { String actionName = [login to view URL]().trim(); if ([login to view URL]() == buttonRetry) { [login to view URL]("Retry button was pressed!"); try { readBuf = getBytesFromFile(new File("C:\\dfvault\\owner_3\\[login to view URL]")); } catch (Exception e) {} imageIcon = new ImageIcon(readBuf); imageButton = new JButton(imageIcon); [login to view URL]([login to view URL]); [login to view URL](true); [login to view URL]([login to view URL]([login to view URL])); [login to view URL]([login to view URL]); repaint(); } else if ([login to view URL]() == buttonSave) { [login to view URL]("Save button was pressed!"); repaint(); } } public void paint(Graphics g) { [login to view URL]([login to view URL](), 20, 100); } public class ImageButton extends JButton { protected void paintComponent(Graphics g) { // Paint the default look of the button. [login to view URL](g); // Your custom painting here. //[login to view URL](foregroundImage, 0, 0, this); } } public void start() { // TODO Auto-generated method stub [login to view URL](); } public void stop() { // TODO Auto-generated method stub [login to view URL](); } public byte[] getBytesFromFile(File file) throws IOException { InputStream is = new FileInputStream(file); long length = [login to view URL](); if (length > Integer.MAX_VALUE) { // File is too large return null; } byte[] bytes = new byte[(int)length]; int offset = 0; int numRead = 0; while (offset < [login to view URL] && (numRead=[login to view URL](bytes, offset, bytes.length-offset)) >= 0) { offset += numRead; } if (offset < [login to view URL]) { throw new IOException("Could not completely read file "+[login to view URL]()); } [login to view URL](); return bytes; } }
Project ID: 3805504

About the project

1 proposal
Remote project
Active 16 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$85 USD in 14 days
5.0 (1 review)
1.9
1.9

About the client

Flag of UNITED STATES
United States
5.0
1
Member since Mar 18, 2008

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.