Tile Scrolling Engine Won't Render Properly

Oct 5, 2014

So I can only get 1 tile to render Okay so now it's no tiles Nvm.

Window
import java.awt.BorderLayout;
import java.awt.HeadlessException;
import java.awt.image.BufferStrategy;
import javax.swing.JFrame;

[code]....

View Replies


ADVERTISEMENT

JSF :: Primefaces Sorting Not Working Properly With Live Scrolling

Dec 15, 2013

I have datatable with live scrolling enabled.The columns are not getting sorted fully.When one of the columns is sorted,for example "insured" in the image shown below, all the records seem to have sorted but when i reach the end of scroll and next set of records get loaded i see other records in unsorted order as indicated in the image ,when i try to see the column in descending order.So because of this i am not getting the sorting feature accurately done(All records are not getting sorted at a single stretch)

My JSF code snippet

<p:dataTable id="workSpaceList" var="data"
value="#{workSpaceBean.lazylpId}" widgetVar="multiSelection"
selection="#{workSpaceBean.selectedRows}" resizableColumns="true"
liveScroll="true" scrollRows="15" scrollWidth="100%"
scrollHeight="75%" styleClass=".ui-datatable-hor-scroll"

[Code] ....

View Replies View Related

2D Tile Game Lag (Caused By Loop) - Rendering All Tile Rectangles

Jan 18, 2014

So the following is my code for the Terrian Generation of my game, however the way i have it rendering all the tile rectangles as opposed to just rendering whats visable on my JFrame causes lots of lag.

These are the variables and Rectangles inside _TerrianGen.class

//CHUNK
static int chunkx =2048;
static int chunky =2048;
 
//RECTANGLES
public static Rectangle[][] tile = new Rectangle[64][64];
static int[][] blockType = new int[64][64];
//0=Grass 1=Dirt 2=Stone 10=Brick 11=Coal 12=Iron 21=Gold 22=Diamond -1=null

This is the Init() code

for (int x =0; x < chunkx-32; x+=32){
for (int y=0; y < chunky-32; y+=32){
tile[y/32][x/32] = new Rectangle(x, y, 32, 32);
blockType[y/32][x/32] = -1;

[Code] ....

View Replies View Related

JSF :: How To Render More Than One JSP Pages Into 1 Single View

May 15, 2014

I have an application where the WebContent folder has a number of .jsp pages like navigation.jsp, primarytabs.jsp etc.

The navigation.jsp contains a vertical menu and the primarytabs.jsp contains a tab on top, and some other jsps contain individual components.

When I run the application of the application server, it opens up a welcome page, and all these navigation items, and tabs and others merge into a single view and show us a well formed combination of all these components.

I did some studying and read about "composite views". But I wasn't sure if I can call this composite view or not.

How JSF combines all these jsps into one view and where to find that "binding" within the code so I can make the relevant changes?

View Replies View Related

Swing/AWT/SWT :: How To Render String In JPanel

Jun 4, 2014

I have used the following code and I am trying to render a String in the JPanel. The text is getting displayed in the mirror image format.

I understand that there is a problem with .scale(), not able to get an idea about the corrective step. Please run the below class.

class Surface extends JPanel {
final int PAD = 40;
private void doDrawing(Graphics g)
{
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);

[Code] ....

View Replies View Related

2D Game Tile

Dec 16, 2014

When the tile loads it loads at the side where i wanted it to be and when my character falls down the image/tile stretches to the collision and stops. looks like this stretches.jpg

The character codes:
error.jpg

And for the Level:
error2.jpg

View Replies View Related

Swing/AWT/SWT :: JTable Not Able To Render Rows In Different Colors

Aug 24, 2014

I have a jtable , a customtablemodel and a customcellrenderer with the NetBeans IDE. I want to have different colors for different rows. But anytime I run the application , the rows are not painted as expected. The code snippets are provided below.

This code is from the jtable :

duesTable = new javax.swing.JTable();
duesTable.setModel(duestableModel);
TableColumn tcol = duesTable.getColumnModel().getColumn(2);
tcol.setCellRenderer(new CustomTableCellRenderer2());
duesTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);

this code is from the TableCellRenderer

public class CustomTableCellRenderer2 extends DefaultTableCellRenderer{
@Override
public Component getTableCellRendererComponent (JTable table,
Object obj, boolean isSelected, boolean hasFocus, int row, int column) {
Component cell = super.getTableCellRendererComponent(
table, obj, isSelected, hasFocus, row, column);

[Code]...

This is from the Table Model.

public class DuesTableModel extends AbstractTableModel implements TableModelListener {
private List<List<Object>> dataList = new ArrayList<>();
private String[] header = { "ID"," PAYMENT YEAR" , "AMOUNT"}; // Payment year is a date
datatype
private int minRowCount = 5;

[Code]....

View Replies View Related

Tile Based Map Editor - Organize Layout

Apr 13, 2014

I'm trying to program a tile-based map editor and most of it is going quite smoothly except trying to organize the layout. Originally I was going to use 2 frames, one for the map, and 1 for the tile set, but after reading about frames I learned that that is bad practice and is also inconvenient because there is no way to have both frames in focus at once (so you need to click an extra time to gain focus when switching windows). So what I'd like to do is create a single frame application that holds 3 panels. One for the map, one for the tile set, and one for tile settings. This is basically what it would look like:

Note that the tile settings panel uses GUI elements (a border, a JLabel (which starts out empty), a JComboBox, and a JTextField) while the other 2 panels are just drawing panels*

Now I have tried multiple things which either did not work visually (panels were inside panels) or did not compile. One thing I tried was using BoxLayout to put the 2 tile panels vertically within a temporary panel which I then tried to add into the frame after the map panel (with FlowLayout), but that made it look like this: I honestly don't know what else I did that I should write here because in retrospect many of the tings I tried were silly or I don't remember exactly what I did. What would be the best layout to doing what I want?

View Replies View Related

Java EE SDK :: Airline Booking Engine - View Completed Booking Ticket Details Continually In Each 30 Seconds

Aug 17, 2012

I am involving in airline booking engine project.

There is a requirement to view a completed booking ticket details continually in each 30 seconds.

Application is already developed using struts / spring and deployed on jBoss server.

I heard spring scheduler and queues. Which is the better solution?

View Replies View Related

Modern Gems - Two Dimensional Tile-management Game

Feb 20, 2014

package modern.gems;
public class Board {
// will need to add params where required ...
private Gem[][] gems;
private int[][] array;
private int rows;
private int cols;

[Code] ....

View Replies View Related

Scrolling In Panel Won't Work

Oct 9, 2014

I've got a panel which an arbitrary number of text fields may be added to at run time. I've got it set up so that the window's height, and the height of the panel in which the fields appear will never exceed the height of the screen.What I don't have is a way to make the panel scroll to access the fields that are being visually truncated. I'm setting the autoscrolls on the panel to true, but when I run the program, the fields are simply truncated.

pnlDeclensions.setAutoscrolls(true);

View Replies View Related

JTable Not Scrolling With Scrollpane

Apr 20, 2015

I am making a table that is dynamically made but it isn't working with scroll bars. The scroll bars show but don't work. Here is the code:

JPanel pList = new JPanel();
Component pListl = new JLabel("Here you can view and search for players.");
pList.add(pListl);
tabbedPane.addTab("Player List",pList);
tabbedPane.setMnemonicAt(0,KeyEvent.VK_1);

[Code] ....

Yes I am spamming entries into the result object, this is so I can test the scrolling as right now I don't have enough data for overflowing entries but will do soon.

View Replies View Related

Swing/AWT/SWT :: JScrollPane Getting Full But Not Scrolling?

Mar 1, 2014

I am trying to create a JScrollPane with buttons in it, but I noticed that when I try to scroll, the items all move into ONE row at the top of the JScrollPane. How do I have them vertical? Is there something wrong with the way I am setting up the JScrollPane?

private static void addScrollPane() {
jScrollPane = new JScrollPane(new JPanel());
((JPanel)jScrollPane.getViewport().getView()).add(new JButton("First Button"));

[Code]....

View Replies View Related

How To Make A Scrolling Background In Java

Nov 1, 2014

i am trying to make a platform game in java and to do this im trying to make a scrolling bacground. i can get the background image to scroll. However, i cant get the image to scroll forever, here is the code.

GamePanel class ( the jpanel )
public class GamePanel extends JPanel implements ActionListener{
static ArrayList<BackGround> store = new ArrayList<BackGround>();
public GamePanel(){
setFocusable(true);
Timer time = new Timer(5,this);
time.start();
store.add(new BackGround(0,-200));

the problem i have is that i want the bacground to loop. however, once the first instance of the background is done scrolling it freezes and doesnt load anymore. here is the code for adding a new background to the list

if(store.get(a).getX() <= -950 ){
GamePanel.store.get(a).setX(-900);
GamePanel.store.add(new BackGround(-951,-200));
}

View Replies View Related

Swing/AWT/SWT :: JScrollPane Programmatic Scrolling

May 24, 2014

I have Implemented a user control / component that allows zooming in and out of a displayed BufferedImage, for discussion's sake, 3rd party libraries are excluded and everything must be from scratch.I have an image rendered on a JPanel, the JPanel is contained within a scrollbar.

Zooming inout etc works perfectly.The Scrollbars are rendered correctly on Zoom In and disappear when I zoom out.I want to add the functionality of focusing on a specific quarter of the displayed image via four dedicated buttons, each send an int (1-4) to a method, that controls the scrollbars.

public void zoomToQuarter(int i)
{
double width = (currentBufferedImage.getWidth()*2.2)+1;
double height = (currentBufferedImage.getHeight()*2.2)+1;
JScrollBar vertical = scrollPane.getVerticalScrollBar();
JScrollBar horizontal = scrollPane.getHorizontalScrollBar();
horizontal.setMaximum((int)width);
vertical.setMaximum((int)height);

[code]....

And resizes the image whilst scrolling the scrollbars accordingly,The method works as expected, and the scrollbars go to the desired location, But there's a catch:The first click on any of the above buttons does not work, but from the second click and on, everything works great!

View Replies View Related

Swing/AWT/SWT :: Tandem Scrolling Of JTables

Jun 14, 2014

I would like to have one horizontal scrollbar control the scrolling of two JScrollPane objects (each of which contains a JTable with similar models). The line of code that I hoped would give me what I want is this:

spUpper.setHorizontalScrollBar(spLower.getHorizontalScrollBar());

It does exactly what I want, except that the scrollbar appears on-screen in the spUpper JScrollPane, while the spLower JScrollPane no longer displays a scrollbar at all. That's the opposite of what I expected. Apparently, spUpper's setHorizontalScrollBar is "stealing" spLower's scrollbar.

An alternative is just to have each scrollbar use the same model, like this:

spUpper.getHorizontalScrollBar().setModel(spLower.getHorizontalScrollBar().getModel());

This links the two scrollbars such that either will control both JScrollPanes (and also the other scrollbar), but it leaves them both visible, which is not what I want. I would have thought this line would make one of them invisible:

spUpper.getHorizontalScrollBar().setVisible(false);

However, it seems to have no effect.

The full code using the first approach is below. My questions are these:

Am I correct that setHorizontalScrollBar not only sets which JScrollBar will control a JScrollPane, but also determines where it appears on the screen?If so, what happens to the original JScrollBar? Is it replaced or am I drawing one on top of the other (or something else)?Why doesn't setVisible(false) make the scrollbar disappear (and how can I do that)?

package tandemtables;
public class Main extends javax.swing.JFrame
{
public Main()

[Code].....

View Replies View Related

2D Slide Scrolling Game - Character Cannot Jump

Mar 31, 2014

There is a problem in my 2D slide scrolling game where the character can't jump until he reaches the enemy.

The Boards class-

package OurGame;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import javax.swing.*;
public class Board extends JPanel implements ActionListener, Runnable {

[Code] .....

View Replies View Related

Swing/AWT/SWT :: Show Labels In A Panel With Scrolling

Oct 31, 2014

I've created a chat program, but now I need to show messages in different colors depending if the message is received or sent. I was wondering if I can use jlabel to do this but in this case I need that jlabels to scroll in a jpanel. how to do this or maybe using a rtf ?

View Replies View Related

Scrolling Panel - Making A Sprite Jump

Apr 6, 2014

I am currently making a platformer game which involves a scrolling panel and a sprite. My intention is for the sprite to be able to jump. My code for the frame that the scrolling panel sits on looks like this:

package Main;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
 
[Code] ....

Currently I have the sprite (jumpMan) displayed on the JumpPanel. This is where I have a key listener that intends to control the jumping of the sprite by incrementally moving the sprite through the space to simulate jumping slightly more accurately. The JumpPanel is laid on top of a panel called the GamePanel which sits between the main frame and the JumpPanel. I currently have a timer on the main frame which is firing off the action listener every 5ms.

My hope was that the action performed would repaint at intervals so that the you would be able to see the sprite at different stages of the jump and then as it descends as well. However when I try to make the sprite jump nothing happens, nothing changes on the screen - when I debug through I can see the code going into both the keyPressed and actionPerformed methods but this doesn't seem to do anything.

View Replies View Related

Java Scrolling Game - Restarting Program

Apr 7, 2015

what I want to be able to do is when the game is over a dialogue box pops up and asks if the user wants to play again and if the user clicks "Yes," then I want to restart the program. I have it to where it recalls my method to play the game which opens the program again, but it doesn't close the old window.

Is there a way to restart the program without the new window popping up? If not, how do I close the old window? Also, how to default the window to being maximized? It makes it easier to see the character and objects on the screen.

View Replies View Related

Swing/AWT/SWT :: Drawings In JPanel Disappears After Scrolling Scrollpane

Jan 15, 2014

I am having problems trying to get my jPanel to display my drawings properly after scrolling. (My drawings is done using by overriding the paint() method as the paintComponent() method does not work in my case.) My jPanel is component of my JScrollpane, and my JScrollpane is part of my jFrame.

The organization of components is: JFrame <-- JScrollPane <-- JPanel ( <-- means added to).

Situation: My drawings did appear when the frame becomes start, but when I start scrolling the scrollbar in any direction, it starts to eat up my drawing leaving only part of drawing which is not affected by scrolling.

I want my jpanel to display the drawing properly even after scrolling in both vertical and horizontal directions. I did use revalidate and repaint methods in my method for start of the JFrame.

Some Ways which I have tried:

1) I have tried adding this.revalidate() and this.repaint() method to the paint() method which did retains the image, but the jPanel keeps blinking on my screen which is trying attempt to update the drawing in a recursive manner.

2) I have tried panel.repaint() and panel.revalidate() in my paint() method, but it did not display my drawing.

3) I have read from other sources that I needed a listener to do it, but I am not sure how it works.

// Code Use for Listener
jScrollPane1.getViewport().addChangeListener(new ListenAdditionsScrolled());
public class ListenAdditionsScrolled implements ChangeListener {
public void stateChanged(ChangeEvent e) {
jPanel3.revalidate();
jPanel3.repaint();
}
}

View Replies View Related

JScrollPane Component Not Scrolling Objects Inside JPanel

Feb 7, 2014

I am trying to place a number of JLabel and JTextField objects inside a JPanel which has a JScrollPane.

One thing is, that at one time, I have have a certain number of JLabel and JTextField objects which number would cover an area greater than the JPanel's vertical size.

How when I implement the JScrollPane and I run the program, the scroll bars appear, but they don't scroll the pane inside the JPanel, the items are fixed.

Could the problem be because I am using a Null Layout.

Will I have to use one of the standard layouts available, like GridLayout for the JScrollPane scrolling function to work?

View Replies View Related

Java Scrolling Game - Moving Image When Key Is Pressed

Mar 19, 2015

Okay, gotta be able to move the image when a key is pressed. When I test it, the image moves, but leaves the old image behind.

package Game;
import java.awt.Component;
import javax.swing.JOptionPane;
 public class Game
{
private Grid grid; //holds the grid used to store and display images
private int userRow; //keep track of which row the user-controlled image appears in
private int msElapsed; //keep track of the total amount of milliseconds that have elapsed since the start of the game

[Code] ....

Here is what I was given on instructions:

Complete the handleKeyPress method. Write the following line of code in the handleKeyPress method to check for a key press:

int key = grid.checkLastKeyPressed();

If the user pressed the up arrow (key == 38), move the user's image up one row (unless the user is already in the top row). Likewise, if the user pressed the down arrow (key == 40), move the user's image down one row (unless the user is already in the bottom row). Either way, make sure to update userRow.

Movement of the image can be accomplished by changing the value of userRow. Study how the initial image is displayed in the game constructor, then

Set the current image location to null

Update userRow to the new location and,

Set the image in the new value of userRow.

You should be able to move the user image up and down, and you should be prevented from moving the image off the screen.

View Replies View Related

Swing/AWT/SWT :: Database Scrolling Button To Display Next And Previous Record

Apr 19, 2014

I have jFrame where I have to display data from database on button click. There are 4 buttons, first to display the first record in database, last to display the last record in database, next to display the next record and previous to display the previous record. I have done first and last record but what should I do to display the next and previous record.

View Replies View Related

JSF :: Primefaces Live Scrolling Taking Long Time With Large Dataset

Feb 21, 2014

I have a primefaces datatable with about 52000 records to be fetched.Since it is a large dataset,i tried using live scrolling feature of primefaces with scroll rows equal to 20.THe number of columns is 53.The table also has filtering and sorting feature on its each column.Still i am not satisfied with the performance of the table.It takes about 15 secs for the page to load,worst thing is that it takes about 65 secs for the next set of 20 records to be loaded on reaching the end of scrolling.

Just for testing i reduced the total number of records to 25000 and the preformance improves with scroll time of 29 secs.I am really not able to understand why it is taking this much time when i am displaying only 20 records at a time.The total number of records should not have affected the performance.

My JSF code snippet

<p:dataTable id="arcRecList" var="data"
value="#{archivedRecordBean.archiveItems}"
tableStyle="table-layout:auto; width:80%;" styleClass="datatable"
scrollable="true" scrollWidth="84%" scrollHeight="69%"
columnClasses="columnwidth" liveScroll="true" scrollRows="20"
filteredValue="#{archivedRecordBean.filteredArchiveItems}">

[Code] ....

View Replies View Related

JSP :: Prevent Dot Matrix Printer Scrolling Entire Sheet After Printing Page As Receipt

Jul 25, 2014

i am developing a web application and uses jsp page to print a payment receipt.

everything works good, but printer scrolls complete sheet after printing first receipt. so need scroll back manually every time i print a receipt.

So, how to stop printer from scrolling entire sheet.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved