⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 numbersummaryitem.java

📁 EclipseTrader is a stock exchange analysis system, featuring shares pricing watch, intraday and hi
💻 JAVA
字号:
/* * Copyright (c) 2004-2006 Marco Maccaferri and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: *     Marco Maccaferri - initial API and implementation */package net.sourceforge.eclipsetrader.charts;import java.text.NumberFormat;import org.eclipse.swt.SWT;import org.eclipse.swt.graphics.Color;import org.eclipse.swt.widgets.Label;public class NumberSummaryItem extends SummaryItem{    private Label number;    private NumberFormat pf = ChartsPlugin.getPriceFormat();    public NumberSummaryItem(Summary parent, int style)    {        super(parent, style);        Color background = parent.getBackground();        Color foreground = parent.getForeground();        number = new Label(parent, SWT.NONE);        number.setBackground(background);        number.setForeground(foreground);        number.setText(getText() + "=" + pf.format(0)); //$NON-NLS-1$                if (background != null)            background.dispose();        if (foreground != null)            foreground.dispose();    }    /* (non-Javadoc)     * @see net.sourceforge.eclipsetrader.charts.SummaryItem#dispose()     */    public void dispose()    {        number.dispose();        super.dispose();    }    public void setData(double value)    {        number.setText(getText() + "=" + pf.format(value)); //$NON-NLS-1$    }    public void setData(Double value)    {        if (value != null)        {            String s = pf.format(value);            if (s.length() >= 9)                s = s.substring(0, s.length() - 5);            number.setText(getText() + "=" + s); //$NON-NLS-1$        }        else            number.setText(getText() + "="); //$NON-NLS-1$    }    /* (non-Javadoc)     * @see net.sourceforge.eclipsetrader.charts.SummaryItem#setForeground(org.eclipse.swt.graphics.Color)     */    public void setForeground(Color color)    {        number.setForeground(color);        super.setForeground(color);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -