Added static plot config for hardware acceleration and heavyweight popup menus
This commit is contained in:
@@ -13,7 +13,7 @@ import javax.swing.JPanel;
|
||||
public interface Plot<T extends PlotSeries> {
|
||||
|
||||
public JPanel getChartPanel();
|
||||
|
||||
|
||||
//Request update on event loop
|
||||
public void update(boolean deferred);
|
||||
|
||||
@@ -61,5 +61,5 @@ public interface Plot<T extends PlotSeries> {
|
||||
X, Y, Z;
|
||||
};
|
||||
|
||||
public Axis getAxis(AxisId id);
|
||||
public Axis getAxis(AxisId id);
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
*
|
||||
*/
|
||||
abstract public class PlotBase<T extends PlotSeries> implements Plot<T> {
|
||||
static{
|
||||
javax.swing.JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
||||
}
|
||||
|
||||
final String LINE_SEPARATOR = System.lineSeparator();
|
||||
final String FIELD_SEPARATOR = "\t";
|
||||
@@ -330,4 +327,28 @@ abstract public class PlotBase<T extends PlotSeries> implements Plot<T> {
|
||||
doUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//Static Configuration
|
||||
|
||||
//Hardware Acceleration
|
||||
static boolean hardwareAccelerated=true;
|
||||
public static void setHardwareAccelerated(boolean value){
|
||||
hardwareAccelerated=value;
|
||||
}
|
||||
|
||||
public static boolean getHardwareAccelerated(){
|
||||
return hardwareAccelerated;
|
||||
}
|
||||
|
||||
static boolean lighweightPopups=true;
|
||||
public static void setLighweightPopups(boolean value){
|
||||
lighweightPopups=value;
|
||||
if (javax.swing.JPopupMenu.getDefaultLightWeightPopupEnabled()!=value){
|
||||
javax.swing.JPopupMenu.setDefaultLightWeightPopupEnabled(lighweightPopups);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getLighweightPopups(){
|
||||
return lighweightPopups;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ import org.jzy3d.plot3d.rendering.view.modes.ViewBoundMode;
|
||||
*
|
||||
*/
|
||||
public class MatrixPlot extends MatrixPlotBase {
|
||||
|
||||
|
||||
JPanel panel;
|
||||
private Chart chart;
|
||||
private Mapper mapper;
|
||||
@@ -76,12 +76,14 @@ public class MatrixPlot extends MatrixPlotBase {
|
||||
};
|
||||
panel.setLayout(new BorderLayout());
|
||||
//panel.setLayout(new GridLayout(1,1));
|
||||
setColormap(Colormap.TEMPERATURE);
|
||||
Settings.getInstance().setHardwareAccelerated(true);
|
||||
setColormap(Colormap.TEMPERATURE);
|
||||
if (getHardwareAccelerated() != Settings.getInstance().isHardwareAccelerated()) {
|
||||
Settings.getInstance().setHardwareAccelerated(getHardwareAccelerated());
|
||||
}
|
||||
panel.setPreferredSize(new Dimension(640, 480));
|
||||
setupPopupMenu();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Object onAddedSeries(final MatrixPlotSeries s) {
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
|
||||
Reference in New Issue
Block a user