hiiii i have a jframe .i have created one panel in it named 'totalGUI'.now i have two panels inside 'totalGUI' named 'panelprices' and 'jpanel'..'panelprices is put inside jscrollpane named 'scrollpane' and 'panelprices' is put inside jscrollpane named 'scrollpane2'.Boths the scrollpanes are added inside totalGUI. 'totalGUI' is added inside jframe. But the problem is while displaying i jst see one vertical scrollbar for panelprices jpanel.i cannot see any other scrollbar.
This is the output what i get.But i want scrollbar on both the sides.This is my code.Please help me solve the problem
[code=Java]
public class BarMaker {
int size = 50000;
int counter = 1;
Map<Double, FootPrintPOJO> priceMap;
Map<Double, Integer> finalMap;
ArrayList<BarPOJO> barPOJOList;
int barCounter = 0;
double latestBid = 0;
double latestAsk = 0;
static int count=0;
public static JFrame frame = new JFrame();
public static ArrayList<JLabel> jlabelarraylist = new ArrayList<>();
public static int x=0;
public static int y=100;
public static int currentY;
public static double maxYprice=0;
public static double minYprice=100000;
public static int minYposition=y;
public static int maxYposition=y;
public static ArrayList<PricePOJO> rowDetails;
public static JScrollPane scrollpane;
public static double price[][]=new double[9000][2];
public static Color color;
public static JPanel jpanel=new JPanel();
public static JPanel panelprices= new JPanel();
public static JPanel totalGUI= new JPanel();
public static void initializePrices()
{
double startprice =300;
int colno=0;
x=0;
for(int i=0;i<9000;i++)
{
price[i][0]=startprice;
price[i][1]=colno;
startprice=NumberFormatter.formatNumber(startprice-0.05);
JLabel jLabel = new JLabel(""+startprice);
jLabel.setBounds(0,colno,65,10);
panelprices.add(jLabel);
panelprices.repaint();
System.out.println(price[i][0]+" "+price[i][1]);
colno=colno+10;
}
}
public BarMaker() {
totalGUI.setPreferredSize(new Dimension(100000,100000));
totalGUI.setLayout(null);
jpanel.setLayout(null);
initializePrices();
x=x+65;
jpanel.setPreferredSize(new Dimension(50000,50000));
//jpanel.setLayout(null);
jpanel.setVisible(true);
jpanel.setBackground(Color.BLUE);
jpanel.setOpaque(true);
jpanel.setVisible(true);
rowDetails = new ArrayList<>();
frame.setVisible(true);
frame.setSize(1000, 900);
priceMap = new TreeMap<Double, FootPrintPOJO>(Collections.reverseOrder());
finalMap = new TreeMap<Double, Integer>();
barPOJOList = new ArrayList<BarPOJO>();
scrollpane = new JScrollPane(panelprices);
scrollpane.setSize(50, 800);
scrollpane.setVisible(true);
jpanel.setLayout(null);
panelprices.setLayout(null);
panelprices.setLocation(0,0);
panelprices.setPreferredSize(new Dimension(70,10000));
panelprices.setOpaque(true);
jpanel.setLocation(90,0);
jpanel.setOpaque(true);
jpanel.setPreferredSize(new Dimension(1000,1000));
JScrollPane scrollpane2=new JScrollPane(jpanel);
scrollpane2.setSize(20,20);
totalGUI.add(scrollpane);
totalGUI.add(scrollpane2);
//scrollpane.setHorizontalScrollBarPolicy(JScrollPan e.HORIZONTAL_SCROLLBAR_ALWAYS);
frame.setContentPane(totalGUI);
}
public void makeBar(double bid, double ask, double ltp, int volume) {
if (priceMap.containsKey(ltp)) {
int newVolume = priceMap.get(ltp).totalVolume;
int volumeAtAsk = priceMap.get(ltp).volumeAtAsk;
int volumeAtBid = priceMap.get(ltp).volumeAtBid;
// ================================================== ====
newVolume = volume + (int) priceMap.get(ltp).totalVolume;
if (ltp >= ask) {
volumeAtAsk = volume + priceMap.get(ltp).volumeAtAsk;
} else if (ltp <= bid){
volumeAtBid = volume + priceMap.get(ltp).volumeAtBid;
}
FootPrintPOJO footPrintPOJO = new FootPrintPOJO(newVolume, volumeAtAsk, volumeAtBid);
priceMap.put(ltp, footPrintPOJO);
int tempcol=0;
if(footPrintPOJO.deltaVolume>0)
{
tempcol=(int) ((footPrintPOJO.volumeAtAsk/(footPrintPOJO.volumeAtBid+1))+1);
while(tempcol>255)
{
tempcol=tempcol-50;
}
color=new Color(255,tempcol,tempcol);
}
}
//while calling initialize is called first
//and then makeBar is called
//and i have other functions which go on adding jlabel in jpanel named 'jpanel' which i m not //displaying to avoid showing unnecessary code
[\code]