Swing/AWT/SWT :: How To Scroll Image
Sep 30, 2014
I have a java swing application.
1. The human user of my application asks it to fire up a scanner which scans a paper document. The document is a filled in form.
2. The application then displays the scanned image to the human user.The image is displayed in a JScrollPane since it may be larger than the scroll pane.
3. The human user needs to locate a certain item in the form, for example a social security number, and enter it into a field in a data entry screen.Note that the image and the field appear on the same screen.
Of-course the social security number always appears in the same location in the image. Also the image needs to be the appropriate magnification and resolution to allow the human user to easily read and understand the item he is searching for in the image.
What is the best way to present the scanned image to the user such that he immediately sees the item he requires and can enter it into the data entry field.
View Replies
ADVERTISEMENT
Apr 17, 2014
I'm having serious issues right now with a JTable inside a JScrollPane.i have some methods that returns different indexes (rows) that i select programatically in a JTable and the problem is that sometimes it goes beyond of what i can see, like, the row gets selected but the scrollbar won't follow up.
i've searched up in google and saw several different methods but those were extremely complex and for stuff i don't need.the simplest solution i found is this:
tInfo.setRowSelectionInterval(searchIndexes.get(currentIndex), searchIndexes.get(currentIndex));
tInfo.scrollRectToVisible(tInfo.getCellRect(currentIndex, 1, true));
but it just doesn't do anything.My table (tInfo) has only two columns so no horizontal bars, just vertical. What can i do to align the scrollbar with the currently selected row in my table? :C
Found a solution using scrollPane.getVerticalScrollBar().setValue();in another thread, i didn't even notice there were like 3 more threads about the same, just different kind of code used in each.
View Replies
View Related
Sep 6, 2014
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
class Stock extends JFrame implements ActionListener
[code]....
well everything seems to be working fine only the scroll pane is not working.
View Replies
View Related
Sep 5, 2014
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
class Stock extends JFrame implements ActionListener
[Code] ....
Everything is fine but the scroll pane is not working!
View Replies
View Related
Sep 7, 2014
Mouse wheel is working properly on macosx but not working on windows.
Here is my layout structure, i implemented mousewheel listener but its not triggering tho.
And my scrolledcomposite declaration:
final ScrolledComposite scrolledComposite = new ScrolledComposite(mainComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_MAGENTA));
final Composite listComposite = new Composite(scrolledComposite, SWT.NONE);
GridLayout layout = new GridLayout();
[Code] ...
View Replies
View Related
Apr 7, 2014
Sir, I'am new to Swing Programming. I have to create an application where an image is displayed on one Label. The same image has to be split in parts and stored in database pert wise. Later the user has to retrieve the entire image by viewing a small part of the image. I have already displayed the full image on the Label, now i don't know how to split the image and store it part wise in the database.
View Replies
View Related
Apr 21, 2015
I got an application with JScrollPanes; they seem to work fine, but fresh after the start, their scrollbars seem dead:I only begin to see their components after resizing the application window with the mouse.Clicking the scroll bars or their buttons (in Metal Look&Feel) does nothing.And there is no 'knob' visible.Dragging the side or bottom of the application window suddenly shows all and makes them operational.My ComponentListener on the window that contains the scrollpanes only does a repaint on the components inside the scrollpanes.Adding such to the code has no effect, neither does a repaint on the scrollpanes themselves.
View Replies
View Related
Dec 24, 2014
I am building a java app and i am wanting to color the 6th 8th and 10th columns differently to make them stand out.
// It creates and displays the table
tableEng = new JTable(buildTableModel(rs));
for(int i=0;i < tableEng.getColumnCount();i++){
packColumn(tableEng,i,5);
[code]....
View Replies
View Related
Mar 8, 2014
I am using jsf with richfaces. Scroll bar inside panel grid is displayed. Need to disable / hide the bowser (IE-9) scroll bar.
style="overflow:hidden"
Added above style, but not working.
View Replies
View Related
Apr 27, 2015
I have tried to add a scroll bar line 28 - 31 and can't figure out why its not working. Its not even showing the scroll bar!
public class TheFrame extends JFrame {
private static ThePanel canvas;
private String deckImagesToUse;
/**
* The constructor creates a Frame ready to display the cards
*/
public TheFrame(String cardImgFile) {
[Code] .....
View Replies
View Related
Jun 20, 2014
I have added the image in the src and bin directories and cross-checked that the name of the image file is correct..Here is the main class
import javax.swing.*;
public class apples
{
public static void main(String args[])
{
JFrame frame = new JFrame();
MyDrawPanel wid = new MyDrawPanel();
frame.add(wid);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setSize(300,300);
}
}
and here is the class that does the image adding part
import java.awt.*;
import javax.swing.*;
public class MyDrawPanel extends JPanel
{
public void paintComponent(Graphics g)
{
Image image = new ImageIcon("b.png").getImage();
g.drawImage(image,20, 20, this);
}
}
View Replies
View Related
Apr 14, 2014
My database contains path of images that I want my jComboBox to diaplay. I have written the following code but it does not work for comboBox but works fine when I display image on jLabel etc. How should I go about this
try {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ex) {
Logger.getLogger(updatedetail.class.getName()).log(Level.SEVERE, null, ex);
[Code] ....
View Replies
View Related
Mar 31, 2015
I already done a lot of work(user lists, server logging, private messages), but im there is few thing i still dont know how to really implement and, of course my current program is far from beign decent, so i decided to start asking questions(so far i was just experimenting just using knowledge from book and some info found on Java API).
1. How can i make JTextField to scroll down each time new message received and log is already full? i mean visible part of it, so you don't need to scroll it yourself...
2. Why sequencer doesn't play MIDI if it is launched not by main thread?
3. What is good way to do user list with avatars? atm, i'm using regular JList and listening to selected values to open dialogs.
4. What is a good ways to implement sounds in application, other than MIDI? i know that i should just google it, but anyway.
You can check my source code for it by link. Chat client:URL...
View Replies
View Related
Feb 19, 2014
Trying to get an image to display in a GUI.
try {
ByteArrayInputStream in = new ByteArrayInputStream(
transferWorker.bOutput
.toByteArray());
BufferedImage bufferedImage = ImageIO
.read(in);
[Code] ....
But nothing is happening in the GUI. I have stepped through and bufferedimage contains the data, but its not being displayed. Whats happening is, an image is being transmitted to serial port of laptop, so i'm taking it in and storing it in a BufferOutputStream and then trying to open it in my GUI class.
View Replies
View Related
Feb 16, 2014
trying to get my image to show up on my compiled GUI.
Here is my GUI, I just need to know how to get the image to show, where do I save an image file so that it comes up in my GUI.
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
[code]...
View Replies
View Related
Jul 23, 2014
How to load an image to a swing application?? I want to load it to myframe(JFrame)..
View Replies
View Related
Jul 10, 2014
I have a GUI with several buttons and I'm using NetBeans GUI Builder to do. At the click of one of these I would like for it to open another frame containing a picture. So I associate a listener (actionPerformed) the button and when clicked it opens actually post the new frame.
In the new frame I waxed a JLabel and then I associate the image of the label. I saw that to do that NetBeans generates this code:
label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/tree.png")));
My problem is that the picture is overwritten several times during the execution of the program is not changed yet in the frame. That is, in the new frame is always displayed an old version of the image.
I have an image that is created every time I click on the button (it always has the same name and same path). Basically I have a generic tree on which I perform the operations (add, remove, etc..). When I click on the button I call a method that generates the image of the tree (using Graphviz). So I have one image that changes over the time...
How can I do so that the image is always up to date?
The Code:
package View;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
public class AlberoIpotesi extends javax.swing.JFrame {
[Code] ....
View Replies
View Related
Mar 28, 2015
why this code, doesn't display the image?
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
[code]...
View Replies
View Related
Aug 15, 2001
Any way to resize an ImageIcon when placing it on a Button so that I don't have to physically rezize the image file?? I am writing an Application, not an applet, so the getImage method won't work.
View Replies
View Related
Mar 11, 2014
I can't find any resource on the net about a simple Java code just to move a gif image left or right. I've already accomplished the up, down, and center and they're working fine, thus, I'm still struggling with moving the image left or right. Here's the code.
public class MoveIt extends Applet implements ActionListener
{
private Image cup;
private Panel keypad;
public int top = 10;
public int left = 10;
[Code] ....
I remember in Visual BASIC it's easily achieved by NameOfImage.left = NameOfImage.left - 10 to move left and NameOfImage.left = NameOfImage.left + 10.
View Replies
View Related
Mar 8, 2015
I simply want to paint an image on my frame, just once each time the paint() method is called, but how to call the paint method in any good way. This is how it looks:
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
[Code] ....
I have a frame in another class, and from my assumption I need to somehow tell my paint method to paint on that specific frame right?
View Replies
View Related
Feb 24, 2014
how to create a jpg image from a JTable ?
View Replies
View Related
Jul 5, 2014
I'm currently following this Java tutorial:[URL]
I'm at the Image part of this chapter and I wrote/copied these 2 classes:
[URL]
The error:
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at image.Board.<init>(Board.java:17)
at image.Image.<init>(Image.java:10)
at image.Image.main(Image.java:20)
I'm fairly certain the problem is the path in this piece of code:
ImageIcon ii = new ImageIcon(this.getClass().getResource("C:GebruikersKristofferworkspaceImagessrcimageNature.jpeg"));
I've done some research and found that I should place the image in the same folder as my .java files, which I did [URL] but the problem still persists.
View Replies
View Related
Jan 19, 2014
I have a class that retrieves an image, and a class that is a game. I want to put my image onto the game to use it as the main figure. As of right now in eclipse, the game class runs, so the game works, but the image doesn't do anything. Need to put the image into the game? Here is my image class:
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
[code]....
View Replies
View Related
Jun 4, 2014
I am trying to input an image into a JTextArea using following code . Image is not displaying in the textarea
else if(action=="Image")
{
final ImageIcon imageIcon=new ImageIcon("E:/Anu/sec.gif");
final Image image=imageIcon.getImage();
Image grayImage = GrayFilter.createDisabledImage(image);
MF.TxtMsg=new JTextArea(){ //MailFrame MF
[code]....
View Replies
View Related
Feb 27, 2014
I'm trying to make a JLabel with an image fade in from transparent to fully visible.Is this possible with the JLabel itself or would I have to change the Image? If I'd have to change the Image's opacity how would I do this?
View Replies
View Related