/*****************************************************************************
* $Id: StatusBar.java,v 1.1.1.1 2000/03/29 22:58:15 kkeys Exp $
*
* File: StatusBar.java Name:StatusBar
* Goal: To write a small panel which will display strings
* in small boxs across the panel.
* It will draw it on to another panel.
* Written: Bradley Huffaker (12/17/97)
*
* For:Cooperative Association for Internet Data Analysis
******************************************************************************
******************************************************************************
By accessing this software, STATUSBAR, you are duly informed of and
agree to be bound by the conditions described below in this notice:
This software product, STATUSBAR, is developed by Bradley Huffaker, and
Jaeyeon Jung copyrighted(C) 1998 by the University of California,
San Diego (UCSD), with all rights reserved. UCSD administers the NLANR
Cache grants, NCR-9796082 and NCR-9616602, under which most of this code
was developed.
There is no charge for STATUSBAR software. You can redistribute it and/or
modify it under the terms of the GNU General Public License, v. 2 dated
June 1991 which is incorporated by reference herein. STATUSBAR is
distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use of
it will not infringe on any third party's intellectual property
rights.
You should have received a copy of the GNU GPL along with the STATUSBAR
program. Copies can also be obtained from
http://www.gnu.org/copyleft/gpl.html or by writing to
University of California, San Diego
SDSC/CAIDA/NLANR
9500 Gilman Dr., MS-0505
La Jolla, CA 92093 - 0505 USA
Or contact INFO@NLANR.NET
*****************************************************************************/
package bhuffake.tools;
import java.awt.*;
public class StatusBar extends Panel
{
// The current string to be displayed in each slot
protected String[] strings;
// The length of the longest string so far displayed in each slot
protected int[] lengths;
// This are the colors which are used for the box effect.
static final protected Color LIGHT = new Color(240,240,240);
static final protected Color TOP = Color.lightGray;
static final protected Color BOTTOM = Color.white;
static final protected Color DARK = Color.darkGray;
// This is the color of the text
protected Color string_color = Color.black;
// The size of the slop on the Box
static final protected int SLOP_X = 2;
static final protected int FLAT_X = 2;
static final protected int SLOP_Y = 2;
static final protected int FLAT_Y = 2;
// This is the total hight that the scroll bar will be if know
protected int total_height = 0;
public StatusBar()
{
strings = new String[2];
lengths = new int[2];
}
/***************************************************************
* Purpose: To set up the arrays. It uses the value of
* of integer to initialize the lengths values and to
* get the size to start with.
****************************************************************/
public StatusBar(int[] input_lengths)
{
strings = new String[input_lengths.length];
lengths = new int[input_lengths.length];
for(int index=0;index < input_lengths.length;index++)
lengths[index] = input_lengths[index];
}
/**************************************************************
* Purpose: To set the strings value at index to string.
* Calls: checkSize() to grow the array if needed.
*
* Special: I would like to be able to check to reset length
* here. But because I can't access the Font Metrics
* I will have to wait to check it every time in paint!
***************************************************************/
public void setString(String string, int index)
{
checkSize(index);
strings[index] = string;
}
/*************************************************************
* Purpose: Returns the string at index.
**************************************************************/
public String getString(int index)
{
if (index >= strings.length)
return null;
return strings[index];
}
/*************************************************************
* Purpose: To set the length of index
* Calls: checkSize() to grow the array if needed.
**************************************************************/
public void setLength(int length, int index)
{
checkSize(index);
lengths[index] = length;
}
/*************************************************************
* Purpose: To return the length at index
**************************************************************/
public int getLength(int index)
{
if (index >= lengths.length)
return 0;
return lengths[index];
}
/*************************************************************
* Purpose: To set the size of the arrays
* Calls: checkSize() to grow the array if needed
**************************************************************/
public void setNumber(int number)
{
if (number < lengths.length)
{
String[] temp_s = new String[number];
int[] temp_l = new int[number];
for (int index=0; index < number; index++)
{
temp_s[index] = strings[index];
temp_l[index] = lengths[index];
}
strings = temp_s;
lengths = temp_l;
}
else
checkSize(number-1);
}
/*************************************************************
* Purpose: To get the size of the array
**************************************************************/
public int getNumber()
{
return strings.length;
}
/**************************************************************
* Purpose: To return the higth that the scroll bar will be, if know
***************************************************************/
public int getHeight()
{
return total_height;
}
/************************************************************
* Purpose: to check to passed location is current in the array.
* and to expanded to array to include it if it is not.
*************************************************************/
public void checkSize(int location)
{
if (location >= lengths.length)
{
String[] temp_s = new String[location+1];
int[] temp_l = new int[location+1];
for (int index=0; index < lengths.length; index++)
{
temp_s[index] = strings[index];
temp_l[index] = lengths[index];
}
strings = temp_s;
lengths = temp_l;
}
}
/*************************************************************
* Purpose: To draw the strings in boxs of size length.
**************************************************************/
public void draw(Graphics g, Dimension dim, FontMetrics fm)
{
int padX = fm.charWidth(' ');
int padY = fm.getHeight();
int y_shift = FLAT_Y + SLOP_Y;
int x_shift = FLAT_X + SLOP_Y;
int box_width = dim.width;
int box_x = 0;
int box_height = padY + 2*y_shift+padY/2;
int box_y = dim.height - box_height;
// Sets the total height
total_height = box_height;
// First draw the raised level
drawHill(g,box_x,box_y,box_width,box_height);
box_y += y_shift;
box_height -= 2*y_shift;
for (int index=0; index < strings.length; index++)
{
String string = strings[index];
if (string != null && lengths[index] < fm.stringWidth(string)+padX)
lengths[index] = fm.stringWidth(string)+padX;
box_x += x_shift;
box_width = lengths[index];
// Makes the last one fill all the way across
if (index == strings.length-1)// && dim.width > box_x + box_width)
box_width = dim.width - x_shift - box_x;
// Draw the hole for the string to side in
drawHole(g, box_x, box_y, box_width, box_height);
// Draw the string inside of each hole
if (string != null)
{
g.setColor(string_color);
g.drawString(string,box_x+padX/2,box_y + padY);
}
box_x += box_width;
}
}
/*************************************************************
* Purpose: To draw a raise area
* Starting at x,y and of size width, height
**************************************************************/
public void drawHill(Graphics g, int x, int y, int width, int height)
{
drawBox(g,LIGHT,TOP,DARK, x, y, width, height);
}
/*************************************************************
* Purpose: To draw a lowered area
* Starting at x,y and of size width, height
**************************************************************/
public void drawHole(Graphics g, int x, int y, int width, int height)
{
drawBox(g,DARK,BOTTOM,LIGHT, x, y, width, height);
}
/*************************************************************
* Purpsoe to draw a two colored box
**************************************************************/
protected void drawBox(Graphics g, Color left, Color middle, Color right
, int x, int y , int width, int height)
{
int[] x_top = {x, x+width, x+width-SLOP_X, x+SLOP_X, x+SLOP_X,
x};
int[] y_top = {y, y, y+SLOP_Y, y+SLOP_Y, y+height-SLOP_Y,
y+height};
int[] x_bot = {x, x+SLOP_X, x+width-SLOP_X,
x+width-SLOP_X, x+width, x+width};
int[] y_bot = {y+height, y+height-SLOP_Y, y+height-SLOP_Y,
y+SLOP_Y, y, y+height};
g.setColor(left);
g.fillPolygon( x_top, y_top, 6);
g.setColor(right);
g.fillPolygon( x_bot, y_bot, 6);
x += SLOP_X;
width -= 2*SLOP_X;
y += SLOP_Y;
height -= 2*SLOP_Y;
g.setColor(middle);
g.fillRect(x,y,width,height);
}
}
"They are called 'sampans,'" Doctor Bronson explained, "and are made entirety of wood. Of late years the Japanese sometimes use copper or iron nails for fastenings; but formerly you found them without a particle of metal about them." "And I am afraid I betrayed the fact," Bruce admitted. "I might have thought of some other way of accounting for my presence here. Still, that rather piratical-looking young man seemed to think you had done right. What's this about some man picked up in the garden?" CHAPTER LII. THE CAGE IS OPENED. Third. Combination machines can only be employed with success when one attendant performs all the operations, and when the change from one to another requires but little adjustment and re-arrangement. When their train approached ours they looked out of the windows, or opened the doors, and waved and greeted and shouted at the top of their voices. me in the cab, he told me that for three days they gave you up. of mind is gone for ever--but anyway, I never cared much for just Two legs waved over the last cockpit place. She waited, too, made silent by sudden realization of how futile anything that she might say would be. "I am glad to see you again," she faltered; "it is four years since Black River and the cloud-burst." She was angry at her own stupidity and want of resource, and her tone was more casual than she meant it to be. The result of this division shook the last resistance of Walpole. When the motion which had been rejected on the 18th of December—for copies of the correspondence with the King of Prussia—was again put, he made no opposition, and it[79] passed without a division. He made, however, one more attempt to carry his measures. In the disputed election of Chippenham he stood his ground against the petition, and was defeated by a majority of one. It was now clear to himself that he must give way. His relatives and friends assured him that to defer longer was only to court more decided discomfiture. On the 31st of January, he, therefore, prepared to depart for his seat at Houghton, and the next morning he demanded of the king, in a private audience, leave to retire. George, on this occasion, evinced a degree of feeling that did him honour. When the old Minister who had served him through so long a course of years knelt to kiss hands, the king embraced him, shed tears, and begged that he would often come to see him. On the 9th of February Sir Robert was created Earl of Orford, and on the 11th he made a formal resignation of all his places. "I'll chance it," said Alf desperately, reaching for the cup of coffee. "I'm sure it'll be better for me to eat something." "They d?an't care, nuther—it's only me." "Wipe the blood off his face." There was silence, in which a coal fell. She still stood with her arms outstretched; he knew that she was calling him—as no woman had ever called him—with all that of herself which was in his heart, part of his own being. HoME免费一1一级做爰片在线观看
ENTER NUMBET 0018www.denstu.com.cn
www.cink.com.cn
linver.com.cn
www.nanaenglish.com.cn
www.gddiou.com.cn
fntx114.com.cn
ulisa.com.cn
www.bpgj.com.cn
www.tianfu6.com.cn
www.hldar.com.cn