from jehep.ui import SetEnv
from jehep.ui import Editor
from javax.swing import JButton, JDialog, JLabel, JPanel, JScrollPane, JTextArea
from java.awt import BorderLayout
from java.awt import Color
from java.awt.event import ActionListener, KeyEvent, KeyListener, MouseListener
from jas.hist import *
from jas.hist.test import MemoryDataSource
frame =JDialog();
topPanel = JPanel();
lowerPanel = JPanel();
plot = JASHist()
plot.setBackground(Color.white)
plot.setTitle("Java Memory Usage")
plot.getYAxis().setLabel("MB")
plot.getXAxis().setLabel("Time")
mem=MemoryDataSource()
plot.addData(mem).show(1);
def exitme(event):
frame.dispose()
def startme(event):
plot.addData(mem).show(1);
def stopme(event):
plot.removeAllData();
jB1 = JButton("Start", actionPerformed=startme)
jB2 = JButton("Stop", actionPerformed=stopme)
jB3 = JButton("Exit", actionPerformed=exitme)
lowerPanel.add(jB1)
lowerPanel.add(jB2)
lowerPanel.add(jB3)
topPanel.setLayout(BorderLayout())
# comments
jScrollPane1 = JScrollPane()
jScrollPane1.getViewport().add( plot );
topPanel.add(jScrollPane1,BorderLayout.CENTER);
frame.add( topPanel, BorderLayout.CENTER );
frame.add( lowerPanel, BorderLayout.SOUTH );
bounds = view.getBounds()
ww = bounds.width
hh= bounds.height
xx = bounds.x
yy = bounds.y
frame.setLocation(xx+(int)(0.4*ww), yy+(int)(0.1*hh))
frame.pack()
frame.setSize( (int)(0.5*ww),(int)(0.8*hh) );
frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE)
frame.setVisible(1)
# jHepWork @S.Chekanov