文件浏览器及数码相框 -2.3.2-freetype_arm-2
显示多行文字
两行文字左边对齐
简单使用两个循环显示两行字体
根据上一行字体的宽度来进行下一行左边的计算
- #include <sys/mman.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
- #include <linux/fb.h>
- #include <fcntl.h>
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <wchar.h>
- #include <ft2build.h>
- #include <stdlib.h>
- #include FT_FREETYPE_H
- #include FT_GLYPH_H
- #include <linux/font.h>
- int fd_fb;
- struct fb_var_screeninfo var; /* Current var */
- struct fb_fix_screeninfo fix; /* Current fix */
- int screen_size; //空间大小
- unsigned char *fb_mem; //framebaffer空间地址
- unsigned int line_width;
- unsigned int pixel_width;
- void lcd_put_pixel(int x, int y, unsigned int color)
- {
- unsigned char *pen_8 = fb_mem + y * line_width + x * pixel_width; //当前像素对应内存位置
- unsigned short *pen_16;
- unsigned int *pen_32;
- unsigned int red, blue, green;
- pen_16 = (unsigned short *)pen_8;
- pen_32 = (unsigned int *)pen_8;
- switch(var.bits_per_pixel)
- {
- case 8:
- {
- *pen_8 = color; //对应调色板颜色
- break;
- }
- case 16:
- {
- /* 5*6*5 */
- red = (color >> 16) & 0xff;
- green = (color >> 8) & 0xff;
- blue = (color >> 0) & 0xff;
- color = ((red >> 3 ) << 11) | ((green >> 2) << 5) | ( blue >> 3);
- /* 颜色数据为高位 */
- *pen_16 = color;
- break;
- }
- case 32:
- {
- *pen_32 = color;
- break;
- }
- }
- }
- void draw_bitmap( FT_Bitmap* bitmap,
- FT_Int x,
- FT_Int y)
- {
- FT_Int i, j, p, q;
- FT_Int x_max = x + bitmap->width;
- FT_Int y_max = y + bitmap->rows;
- printf("x = %d, y = %d\n", x, y);
- for ( i = x, p = 0; i < x_max; i++, p++ )
- {
- for ( j = y, q = 0; j < y_max; j++, q++ )
- {
- if ( i < 0 || j < 0 ||
- i >= var.xres || j >= var.yres )
- continue;
- // image[j][i] |= bitmap->buffer[q * bitmap->width + p];
- lcd_put_pixel(i, j, bitmap->buffer[q * bitmap->width + p]);
- }
- }
- }
- int main(int argc, char **argv)
- {
- wchar_t * str1 = L"陈志朋gif";
- wchar_t * str2 = L"hello the world";
- FT_BBox bbox;
- FT_Glyph glyph;
- FT_Library library;
- FT_Face face;
- FT_Vector pen; /* untransformed origin */
- FT_GlyphSlot slot;
- FT_Matrix matrix; /* transformation matrix */
- int error;
- double angle;
- int i;
- int line_box_ymin = 10000;
- int line_box_ymax = 0;
- if(argc != 2)
- {
- printf("Usage : %s <font_file> <angle>\n",argv[0]);
- return -1;
- }
- fd_fb = open("/dev/fb0",O_RDWR);
- if(fd_fb < 0)
- {
- printf("can't open /dev/fb0 \n");
- return -1;
- }
- if(ioctl(fd_fb, FBIOGET_VSCREENINFO, &var))
- {
- printf("can't get var \n");
- return -1;
- }
- if(ioctl(fd_fb, FBIOGET_FSCREENINFO, &fix))
- {
- printf("can't get fix \n");
- return -1;
- }
- screen_size = var.xres * var.yres * var.bits_per_pixel / 8; //单位字节
- line_width = var.xres * var.bits_per_pixel / 8;
- pixel_width = var.bits_per_pixel / 8;
- fb_mem = (unsigned char *)mmap(NULL, screen_size, \
- PROT_READ | PROT_WRITE, MAP_SHARED, fd_fb, 0);
- if(fb_mem == (unsigned char *) -1)
- {
- printf("can't mmap \n");
- return -1;
- }
- memset(fb_mem, 0, screen_size);
- /* 显示矢量文字 */
- error = FT_Init_FreeType( &library ); /* initialize library */
- /* error handling omitted */
- error = FT_New_Face( library, argv[1], 0, &face ); /* create face object */
- /* error handling omitted */
- slot = face->glyph;
- FT_Set_Pixel_Sizes(face, 24, 0);
- /*确定坐标
- *lcd_x = 0
- *lcd_y = 24
- *笛卡尔坐标
- *x = lcd_x = 0
- *y = var.yres - 24
- */
- pen.x = ( 0 ) * 64;
- pen.y = ( var.yres - 24 ) * 64;
- for(i = 0; i < wcslen(str1); i++)
- {
- /* set transformation */
- FT_Set_Transform( face,0, &pen );
- /* load glyph image into the slot (erase previous one) */
- error = FT_Load_Char( face, str1[i], FT_LOAD_RENDER );
- if ( error )
- {
- printf("FT_Load_Char error\n");
- return -1;
- }
- error = FT_Get_Glyph( face->glyph, &glyph );
- if (error)
- {
- printf("FT_Get_Glyph error!\n");
- return -1;
- }
- FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_TRUNCATE, &bbox );
- if(line_box_ymin > bbox.yMin)
- line_box_ymin = bbox.yMin;
- if(line_box_ymax < bbox.yMax)
- line_box_ymax = bbox.yMax;
- /* now, draw to our target surface (convert position) */
- draw_bitmap( &slot->bitmap,
- slot->bitmap_left,
- var.yres - slot->bitmap_top );
- pen.x += slot->advance.x;
- }
- /*确定坐标
- *lcd_x = 0
- *lcd_y = 24
- *笛卡尔坐标
- *x = lcd_x = 0
- *y = var.yres - 24
- */
- pen.x = ( 0 ) * 64;
- pen.y = ( var.yres - (line_box_ymax - line_box_ymin + 24) ) * 64;
- for(i = 0; i < wcslen(str2); i++)
- {
- /* set transformation */
- FT_Set_Transform( face,0, &pen );
- /* load glyph image into the slot (erase previous one) */
- error = FT_Load_Char( face, str2[i], FT_LOAD_RENDER );
- if ( error )
- {
- printf("FT_Load_Char error\n");
- return -1;
- }
- error = FT_Get_Glyph( face->glyph, &glyph );
- if (error)
- {
- printf("FT_Get_Glyph error!\n");
- return -1;
- }
- FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_TRUNCATE, &bbox );
- if(line_box_ymin > bbox.yMin)
- line_box_ymin = bbox.yMin;
- if(line_box_ymax < bbox.yMax)
- line_box_ymax = bbox.yMax;
- /* now, draw to our target surface (convert position) */
- draw_bitmap( &slot->bitmap,
- slot->bitmap_left,
- var.yres - slot->bitmap_top );
- pen.x += slot->advance.x;
- }
- }
使用freetpye中的函数实现一行文字居中
4.6 高级文本渲染:变换 + 居中 + 字距调整
现在我们将修改我们的代码,以便可以容易地变换已渲染的字符串,例如旋转它。我们将以实行少许小
改进开始:
4.6.1 打包然后平移字形
我们先把与一个字形图像相关的信息打包到一个结构体,而不是并行的数组。因此我们定义下面的结构
体类型:
typedef struct TGlyph_
{
FT_UInt index; /* 字形索引 */
FT_Vector pos; /* 基线上面的字形原点 */
FT_Glyph image; /* 字形图像 */
} TGlyph, *PGlyph;
我们在装载每一个字形图像过程中,在把它装载它在基线所在位置后便直接平移它。我们将看到,这有若干
好处。我们的字形序列装载其因而变成:
FT_GlyphSlot slot = face->glyph; /* 一个小捷径 */
FT_UInt glyph_index;
FT_Bool use_kerning;
FT_UInt previous;
int pen_x, pen_y, n;
TGlyph glyphs[MAX_GLYPHS]; /* 字形表 */
PGlyph glyph; /* 表中的当前字形*/
FT_UInt num_glyphs;
... 初始化库 ...
... 创建 face 对象 ...
... 设置字符尺寸 ...
pen_x = 0; /* 以 (0,0) 开始 */
pen_y = 0;
num_glyphs = 0;
use_kerning = FT_HAS_KERNING( face );
previous = 0;
glyph = glyphs;
for ( n = 0; n < num_chars; n++ )
{
glyph->index = FT_Get_Char_Index( face, text[n] );
if ( use_kerning && previous && glyph->index )
{
FT_Vector delta;
FT_Get_Kerning( face, previous, glyph->index,
FT_KERNING_MODE_DEFAULT, &delta );
pen_x += delta.x >> 6;
}
/* 保存当前笔位置 */
glyph->pos.x = pen_x;
glyph->pos.y = pen_y;
error = FT_Load_Glyph(face,glyph_index,FT_LOAD_DEFAULT);
if ( error ) continue;
error = FT_Get_Glyph( face->glyph, &glyph->image );
if ( error ) continue;
/* 现在平移字形图像 */
FT_Glyph_Transform( glyph->image, 0, &glyph->pos );
pen_x += slot->advance.x >> 6;
previous = glyph->index;
/* 增加字形的数量 */
glyph++;
}
/* 计算已装载的字形的数量 */
num_glyphs = glyph - glyphs;
注意,这个时候平移字形有若干好处。第一是当我们计算字符串的边界框时不需要平移字形 bbox。代码将会
变成这样:
void compute_string_bbox( FT_BBox *abbox )
{
FT_BBox bbox;
bbox.xMin = bbox.yMin = 32000;
bbox.xMax = bbox.yMax = -32000;
for ( n = 0; n < num_glyphs; n++ )
{
FT_BBox glyph_bbox;
FT_Glyph_Get_CBox( glyphs[n], &glyph_bbox );
if (glyph_bbox.xMin < bbox.xMin)
bbox.xMin = glyph_bbox.xMin;
if (glyph_bbox.yMin < bbox.yMin)
bbox.yMin = glyph_bbox.yMin;
if (glyph_bbox.xMax > bbox.xMax)
bbox.xMax = glyph_bbox.xMax;
if (glyph_bbox.yMax > bbox.yMax)
bbox.yMax = glyph_bbox.yMax;
}
if ( bbox.xMin > bbox.xMax )
{
bbox.xMin = 0;
bbox.yMin = 0;
bbox.xMax = 0;
bbox.yMax = 0;
}
*abbox = bbox;
}
更详细描述: compute_string_bbox 函数现在可以计算一个已转换的字形字符串的边界框。例如,我们可以做
如下的事情:
FT_BBox bbox;
FT_Matrix matrix;
FT_Vector delta;
... 装载字形序列 ...
... 设置 "matrix" 和 "delta" ...
/* 变换字形 */
for ( n = 0; n < num_glyphs; n++ )
FT_Glyph_Transform( glyphs[n].image, &matrix, &delta );
/* 计算已变换字形的边界框 */
compute_string_bbox( &bbox );
- #include <sys/mman.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
- #include <linux/fb.h>
- #include <fcntl.h>
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <wchar.h>
- #include <ft2build.h>
- #include <stdlib.h>
- #include FT_FREETYPE_H
- #include FT_GLYPH_H
- #include <linux/font.h>
- #define MAX_GLYPHS 100
- typedef struct TGlyph_
- {
- FT_UInt index; /* ???? */
- FT_Vector pos; /* ????????? */
- FT_Glyph image; /* ???? */
- } TGlyph, *PGlyph;
- int fd_fb;
- struct fb_var_screeninfo var; /* Current var */
- struct fb_fix_screeninfo fix; /* Current fix */
- int screen_size; //空间大小
- unsigned char *fb_mem; //framebaffer空间地址
- unsigned int line_width;
- unsigned int pixel_width;
- void lcd_put_pixel(int x, int y, unsigned int color)
- {
- unsigned char *pen_8 = fb_mem + y * line_width + x * pixel_width; //当前像素对应内存位置
- unsigned short *pen_16;
- unsigned int *pen_32;
- unsigned int red, blue, green;
- pen_16 = (unsigned short *)pen_8;
- pen_32 = (unsigned int *)pen_8;
- switch(var.bits_per_pixel)
- {
- case 8:
- {
- *pen_8 = color; //对应调色板颜色
- break;
- }
- case 16:
- {
- /* 5*6*5 */
- red = (color >> 16) & 0xff;
- green = (color >> 8) & 0xff;
- blue = (color >> 0) & 0xff;
- color = ((red >> 3 ) << 11) | ((green >> 2) << 5) | ( blue >> 3);
- /* 颜色数据为高位 */
- *pen_16 = color;
- break;
- }
- case 32:
- {
- *pen_32 = color;
- break;
- }
- }
- }
- void draw_bitmap( FT_Bitmap* bitmap,
- FT_Int x,
- FT_Int y)
- {
- FT_Int i, j, p, q;
- FT_Int x_max = x + bitmap->width;
- FT_Int y_max = y + bitmap->rows;
- printf("x = %d, y = %d\n", x, y);
- for ( i = x, p = 0; i < x_max; i++, p++ )
- {
- for ( j = y, q = 0; j < y_max; j++, q++ )
- {
- if ( i < 0 || j < 0 ||
- i >= var.xres || j >= var.yres )
- continue;
- // image[j][i] |= bitmap->buffer[q * bitmap->width + p];
- lcd_put_pixel(i, j, bitmap->buffer[q * bitmap->width + p]);
- }
- }
- }
- int Get_Glphs_Frm_Wstr(FT_Face face, wchar_t * wstr, TGlyph glyphs[])
- {
- PGlyph glyph = glyphs;
- FT_GlyphSlot slot = face->glyph;
- int n;
- int pen_x =0;
- int pen_y = 0;
- int error;
- for(n = 0; n < wcslen(wstr); n++ )
- {
- glyph->index = FT_Get_Char_Index( face, wstr[n] );
- /* 保存当前笔位置 */
- glyph->pos.x = pen_x;
- glyph->pos.y = pen_y;
- /* load 是把glyph 加载到face->glyph */
- error = FT_Load_Glyph(face, glyph->index, FT_LOAD_DEFAULT);
- if ( error )
- continue;
- error = FT_Get_Glyph( face->glyph, &glyph->image );
- if ( error )
- continue;
- /* 现在平移字形图像 */
- /* 使得glyph->image里面有位置信息 */
- FT_Glyph_Transform( glyph->image, 0, &glyph->pos );
- pen_x += slot->advance.x; /* 1 / 64 piont */
- /* 增加字形的数量 */
- glyph++;
- }
- /* 计算已装载的字形的数量 */
- return (glyph - glyphs);
- }
- void compute_string_bbox( TGlyph glyphs[], FT_UInt num_glyphs, FT_BBox *abbox )
- {
- FT_BBox bbox;
- int n;
- bbox.xMin = bbox.yMin = 32000;
- bbox.xMax = bbox.yMax = -32000;
- for ( n = 0; n < num_glyphs; n++ )
- {
- FT_BBox glyph_bbox;
- FT_Glyph_Get_CBox( glyphs[n].image, FT_GLYPH_BBOX_TRUNCATE, &glyph_bbox );
- if (glyph_bbox.xMin < bbox.xMin)
- bbox.xMin = glyph_bbox.xMin;
- if (glyph_bbox.yMin < bbox.yMin)
- bbox.yMin = glyph_bbox.yMin;
- if (glyph_bbox.xMax > bbox.xMax)
- bbox.xMax = glyph_bbox.xMax;
- if (glyph_bbox.yMax > bbox.yMax)
- bbox.yMax = glyph_bbox.yMax;
- }
- *abbox = bbox;
- }
- void Draw_Glyphs(TGlyph glyphs[], FT_UInt num_glyphs, FT_Vector pen)
- {
- int n;
- int error;
- for ( n = 0; n < num_glyphs; n++ )
- {
- FT_Glyph_Transform( glyphs[n].image, 0, &pen );
- error = FT_Glyph_To_Bitmap(&glyphs[n].image, FT_RENDER_MODE_NORMAL, 0, 1 ); /* 没有附加的平移*//* 销毁 "image" 指向的副本 */
- if ( !error )
- {
- FT_BitmapGlyph bit = (FT_BitmapGlyph)glyphs[n].image;
- draw_bitmap( &bit->bitmap, bit->left, var.yres - bit->top);
- FT_Done_Glyph( glyphs[n].image );
- }
- }
- }
- int main(int argc, char **argv)
- {
- wchar_t * str1 = L"陈志朋gif";
- wchar_t * str2 = L"hello the world";
- FT_BBox bbox;
- FT_Glyph glyph;
- FT_Library library;
- FT_Face face;
- FT_Vector pen; /* untransformed origin */
- FT_GlyphSlot slot;
- FT_Matrix matrix; /* transformation matrix */
- TGlyph glyphs[MAX_GLYPHS]; /* ??? */
- FT_UInt num_glyphs;
- int error;
- double angle;
- int i;
- int line_box_ymin = 10000;
- int line_box_ymax = 0;
- int line_box_width;
- int line_box_hight;
- if(argc != 2)
- {
- printf("Usage : %s <font_file> <angle>\n",argv[0]);
- return -1;
- }
- fd_fb = open("/dev/fb0",O_RDWR);
- if(fd_fb < 0)
- {
- printf("can't open /dev/fb0 \n");
- return -1;
- }
- if(ioctl(fd_fb, FBIOGET_VSCREENINFO, &var))
- {
- printf("can't get var \n");
- return -1;
- }
- if(ioctl(fd_fb, FBIOGET_FSCREENINFO, &fix))
- {
- printf("can't get fix \n");
- return -1;
- }
- screen_size = var.xres * var.yres * var.bits_per_pixel / 8; //单位字节
- line_width = var.xres * var.bits_per_pixel / 8;
- pixel_width = var.bits_per_pixel / 8;
- fb_mem = (unsigned char *)mmap(NULL, screen_size, \
- PROT_READ | PROT_WRITE, MAP_SHARED, fd_fb, 0);
- if(fb_mem == (unsigned char *) -1)
- {
- printf("can't mmap \n");
- return -1;
- }
- memset(fb_mem, 0, screen_size);
- /* 显示矢量文字 */
- error = FT_Init_FreeType( &library ); /* initialize library */
- /* error handling omitted */
- error = FT_New_Face( library, argv[1], 0, &face ); /* create face object */
- /* error handling omitted */
- slot = face->glyph;
- FT_Set_Pixel_Sizes(face, 24, 0);
- num_glyphs = Get_Glphs_Frm_Wstr(face, str1, glyphs);
- compute_string_bbox(glyphs, num_glyphs, &bbox);
- line_box_width = bbox.xMax - bbox.xMin;
- line_box_hight = bbox.yMax - bbox.yMin;
- pen.x = (var.xres - line_box_width) / 2 * 64;
- pen.y = (var.yres - line_box_hight) / 2 * 64;
- Draw_Glyphs(glyphs, num_glyphs, pen);
- num_glyphs = Get_Glphs_Frm_Wstr(face, str2, glyphs);
- compute_string_bbox(glyphs, num_glyphs, &bbox);
- line_box_width = bbox.xMax - bbox.xMin;
- line_box_hight = bbox.yMax - bbox.yMin;
- pen.x = (var.xres - line_box_width) / 2 * 64;
- pen.y = pen.y - 24 * 64;
- Draw_Glyphs(glyphs, num_glyphs, pen);
- }
中心双行输出
4.6.2 渲染一个已变换的字形序列
无论如何,如果我们想重用字形来以不同的角度或变换方式绘制字符串,直接变换序列中的字形都不是
一个好主意。更好的方法是在字形被渲染前执行放射变换,如下面的代码所示:
FT_Vector start;
FT_Matrix transform;
/* 获取原始字形序列的 bbox */
compute_string_bbox( &string_bbox );
/* 计算整数象素表示的字符串尺度 */
string_width = (string_bbox.xMax - string_bbox.xMin) / 64;
string_height = (string_bbox.yMax - string_bbox.yMin) / 64;
/* 设置 26.6 笛卡儿空间表示的笔起始位置 */
start.x = ( ( my_target_width - string_width ) / 2 ) * 64;
start.y = ( ( my_target_height - string_height ) / 2 ) * 64;
/* 设置变换(旋转) */
matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L );
matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L );
matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L );
matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L );
for ( n = 0; n < num_glyphs; n++ )
{
FT_Glyph image;
FT_Vector pen;
FT_BBox bbox;
/* 创建原始字形的副本 */
error = FT_Glyph_Copy( glyphs[n].image, &image );
if ( error ) continue;
/* 变换副本(这将平移它到正确的位置) */
FT_Glyph_Transform( image, &matrix, &start );
/* 检查边界框;如果已变换的字形图像不在*/
/* 我们的目标表面中,我们可以避免渲染它 */
FT_Glyph_Get_CBox( image, ft_glyph_bbox_pixels, &bbox );
if ( bbox.xMax <= 0 || bbox.xMin >= my_target_width ||
bbox.yMax <= 0 || bbox.yMin >= my_target_height )
continue;
/* 把字形图像转换为位图(销毁字形的副本!) */
error = FT_Glyph_To_Bitmap(
&image,
FT_RENDER_MODE_NORMAL,
0, /* 没有附加的平移*/
1 ); /* 销毁 "image" 指向的副本 */
if ( !error )
{
FT_BitmapGlyph bit = (FT_BitmapGlyph)image;
my_draw_bitmap( bitmap->bitmap,
bitmap->left,
my_target_height - bitmap->top );
FT_Done_Glyph( image );
}
}
这份代码相对于原始版本有少许改变:
z 我们没改变原始的字形图像,而是变换该字形图像的拷贝。
z 我们执行“剪取”操作以处理渲染和绘制的字形不在我们的目标表面(surface)的情况。
z 当调用 FT_Glyhp_To_Bitmap 时,我们总是销毁字形图像的拷贝,这是为了销毁已变换的图像。注意,即
使当这个函数返回错误码,该图像依然会被销毁(这就是为什么 FT_Done_Glyph 只在复合语句中被调用
的原因)。
z 平移字形序列到起始笔位置集成到 FT_Glyph_Transform 函数,而不是 FT_Glyph_To_Bitmap 函数。
可以多次调用这个函数以渲染字符串到不同角度的,或者甚至改变计算 start 的方法以移动它到另外的地
方。无论如何,要注意通常的实现会使用一个字形缓冲以减少内存消耗。据个例子,让我们假定我们的字符
文件浏览器及数码相框 -2.3.2-freetype_arm-2的更多相关文章
- 文件浏览器及数码相框 -2.3.2-freetype_arm-1
交叉编译:tar xjf freetype-2.4.10.tar.bz2 ./configure --host=arm-linuxmakemake DESTDIR=$PWD/tmp install f ...
- 文件浏览器及数码相框 -2.3.1freetype_pc
例子 #include <stdio.h> #include <string.h> #include <math.h> #include <ft2build. ...
- 下载apk文件浏览器会直接打开并显示乱码的问题
今天同事反映他的apk文件在自己的老项目中下载有问题:下载apk文件浏览器会直接打开并显示乱码,在别的项目中就没有问题. 后分析response的content-type发现,老项目的类型是text/ ...
- Win 10 文件浏览器无法打开
今天遇到个很奇怪的问题,文件浏览器File Explorer无法正常显示,点击打开后任务栏上已经显示打开了,但是屏幕上却看不到任何窗口,开始以为机子中了恶意的木马,然后就疯狂的查毒,然而并没有解决问题 ...
- Mac下DIY文件浏览器
2015-07-14 15:07:53 Mac下的finder不能浏览Linux文件目录, 一些优秀的资源管理器是收费的..... 于是想到了既然Mac的本质是类Unix, 而在windows下查看L ...
- 比nerdtree更好的文件浏览器:vimfiler
通过:VimFilerExplorer来打开一个文件浏览器 h:收起 t:展开 -:close 回车:进入或展开 空格:收起
- 【转】显示Ubuntu文件浏览器的地址栏--不错
原文网址:http://www.blogbus.com/anythingok-logs/144447448.html Ubuntu默认使用nautilus作为其可视化的文件浏览器,其默认值不显示地址栏 ...
- 【Java】 实现一个简单文件浏览器(1)
学习Java的Swing的时候写的一个超简单文件浏览器 效果如图: 项目结构: 这里面主要用了两个控件,JTree和JTable 下面先说下左侧的文件树如何实现: 首先是FileTree类,继承于JT ...
- SharePoint 2013 解惑 无法打开文件浏览器
你有时候会看到这东西谈出来,当你想像管理文件一样,管理SharePoint上资源的时候 意思是说,不能打开文件浏览器,请加入你的站点到信任站点,这个有两个问题,一个是IE设置,一个是WebClient ...
随机推荐
- laravel 开启sql查询日志
\DB::enableQueryLog(); dd(\DB::getQueryLog());
- 20160805_CentOS6_控制台切换
1. Ctrl + Alt + F1~F6 Ctrl + Alt + F1 是 图形界面(如果装了的话),后面的是 控制台界面 2. 3.
- html5常用API之Full Screen
所谓Full Screen API,就是全屏API,在html5中,该API允许开发者以编程方式将Web应用程序全屏运行,使Web应用程序更像本地应用程序.这款API十分简单有用,是html5初学者必 ...
- 犯过错误的C语言问题
1 memcpy函数: 函数原型:void *memcpy(void *dest, void *src, unsigned int count); 函数源码: void *memcpy1(void * ...
- er6855的工作经验
1 VIEWS里面的关系要搞清楚 里面的内容类型要理清 不要相信别人做好的事情 不要相信看到的结果 2 git rm -rf之后需要git commit提交到.git文件中正式生效 不然可能就是中间打 ...
- HTTP Content-Type的作用
在用java的 AsyncHttpClient与服务器通信时,忘记设置了 Content-Type的值,开始以为没有问题,使用默认的值就行 后面出现了问题.查资料发现,Content-Type是用在M ...
- linux笔记:用户配置文件
用户信息文件:/etc/passwd功能:存放用户基本信息每一行代表一个用户. 第一字段:用户名称第二字段:密码标志(只是一个密码的占位符,表示该用户有密码,不存放真正的密码)第三字段:UID(用户I ...
- WANL标准组织介绍-02
无线电管理委员会 FCC ETSI IEEE Wi-Fi IETF WAPI 国家无线电管理委员会认证 国家无线电管理委员会认证(State Radio Regulatory Commission o ...
- 为MySQL选择合适的备份方式
数据库的备份是极其重要的事情.如果没有备份,遇到下列情况就会抓狂: UPDATE or DELETE whitout where… table was DROPPed accidentally… IN ...
- Hadoop-env.sh[翻译]
说明: 某天 ,把hadoop-env.sh的注释看了看 , 感觉受益匪浅,于是想要写一篇告诉大家,文档是最靠谱的,鉴于我的水平有限,只能翻译大概,切勿吐槽,提建议请留言 摘要: 1.这个文件中只有J ...