我设计的网站使用导航菜单显示子菜单:悬停.初始站点没有使用任何响应式设计:它仅针对桌面环境.我现在使用响应式设计技术来定位移动设备和平板电脑,其中许多是基于触摸而不是基于鼠标.
我面临的一个大问题(以及许多其他人似乎也面临过)是基于悬停的导航菜单:它在鼠标环境中运行良好,但在触摸设备上,没有可靠的方法来触发悬停,该页面难以使用.
目标是这样的:
我的团队不愿意牺牲基于鼠标的机器上的悬停效果.他们喜欢它,不想根据所有设备点击菜单.我同意这一点.
环顾网后,我找不到任何解决方案.我把它们中的一些放在一起并开发了一些在Android上测试得很好的东西,获得了我想要的功能.有什么可以改进的和/或你看到这种方法有什么问题吗?
jQuery(document).ready(function() {
var touched=false;
jQuery(".nav").on('touchstart', 'li .has_children', function (e) { touched=true; });
jQuery("html").on('mousemove', function (e) { touched=false; });
jQuery("html").on('click', updatePreviousTouched );
jQuery(".nav").on('click', 'li .has_children', function (e) {
updatePreviousTouched(e);
if( touched ) {
if (jQuery(this).data('clicked_once')) {
jQuery(this).data('clicked_once', false);
return true;
} else {
e.preventDefault();
jQuery(this).trigger("mouseenter");
jQuery(this).data('clicked_once', true);
}
}
touched=false;
});
var previous_touched;
function updatePreviousTouched(e) {
if( typeof previous_touched != 'undefined' && previous_touched != null && !previous_touched.is( jQuery(e.target) ) ) { …Run Code Online (Sandbox Code Playgroud) 我编写了一个程序,它使用了javafx中的拖放功能.在JavaFX8中它完美运行.
在JavaFX11中,拖放功能失效:我没有得到一个不同的鼠标光标,我没有得到我正在拖动的行的鬼图像,并且滴有些错误 - 它们不会触发鼠标释放,然后每次我点击表格时触发掉落.
这是最小的可运行示例,它演示了我面临的问题.在Java 8 JVM上运行它可以根据需要运行.在Java 11 JVM上它没有.我在Ubuntu 18.04上.
我很好地改变我的代码以适应Java 11,但我不知道我做错了什么.
Java 11版
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
Run Code Online (Sandbox Code Playgroud)
Java 8版
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
Run Code Online (Sandbox Code Playgroud)
DND11.java
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.scene.Scene;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableRow;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;
import javafx.scene.input.Dragboard;
import javafx.scene.input.TransferMode;
import …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个简单的方法来切换我的窗口是否被最小化(即图标化).我的行为很奇怪.下面是说明问题的可运行代码.
我在Gnome 3.20.4和XFCE 4.12上获得了相同的结果.我还没有在任何其他环境中测试过这个.
<--)放在文本输出与视觉输出不匹配的行旁边.Windows未最大化行为
Before call (Note: Window appears iconified)
isIconified(): true
isMaximized(): true
Setting iconified to false
After call (Note: Window now appears restored, not maximized)
isIconified(): true <-- The window is visually not iconified
isMaximized(): true <-- The window is visually not maximized
Before call (Note: Window still appears restored, not maximized)
isIconified(): false <-- One second later, the report is accurate
isMaximized(): false
Setting iconified to true
After call (Note: Window now appears …Run Code Online (Sandbox Code Playgroud) 我有一个简单的java类,看起来像这样:
public class Skin implements Serializable {
public String scoreFontName = "TahomaBold";
...
public int scoreFontHeight = 20;
...
public int blockSize = 16;
...
public int[] nextBlockX = {205, 205, 205, 205};
...
public String backgroundFile = "back.bmp";
...
}
Run Code Online (Sandbox Code Playgroud)
我想从一个看起来像这样的简单XML文件中读取这些信息:
<xml>
<skin>
<scoreFontName>"Tahoma Bold"</scoreFontName>
...
<scoreFontHeight>20</scoreFontHeight>
...
<blockSize>16</blockSize>
...
<nextBlockX>
<0>205</0>
<1>205</1>
<2>205</2>
<3>205</3>
<nextBlockX>
....
<backgroundFile>"back.bmp"</backgroundFile>
...
<skin>
</xml>
Run Code Online (Sandbox Code Playgroud)
有没有一种简单的方法可以将xml文件中的信息直接注入变量名称而不必手动解析?我不介意使用外部库.
任何帮助表示赞赏.
我想做这样的事情:
.even {
float: left;
text-align: left;
}
.even img {
float: right;
}
Run Code Online (Sandbox Code Playgroud)
虽然不行.我希望我的问题只是语法问题,但我无法弄清楚如何做到这一点.我在谷歌周围挖,但我找不到合适的关键字.
我想使用的关联html应该看起来像:
<div class="linkBlock even">
<img class="linkThumbnail" src="graphics/links/thumbnail_oilcan.jpg" width="267" height="200"/>
<h2><a href="http://www.etsy.com/shop/oilcanpress" rel="nofollow">oilcan press</a></h2>
<p>
oilcan press is a purveyor of handmade books & word-related artefacts.
if you'd like to commission work of a particular size or shape or theme let him
know via etsy or email: oilcanpress [!at] gmail.com
they will gladly make custom boxes as per your general requests of colors/concepts.
if you are …Run Code Online (Sandbox Code Playgroud) 我正在编写一个 wav 播放器,并且正在使用以下文件格式规范: http: //soundfile.sapp.org/doc/WaveFormat/。
正如您所看到的,它期望:
我有一个音频文件,在格式块和数据块之间有一个“LIST”块,当我对文件进行十六进制编辑时,您可以直观地看到它:
这个 LIST 块是什么?它是某种标准化文件格式的一部分吗?是否有地方提供有关解析它的信息?
对于我的网站的低宽度移动版本,我切换display的某些table,tr,td,和th来block,让他们垂直堆叠.我使用它作为一种技术,允许宽表继续显示其所有内容,而不会溢出其容器外.
它适用于所有现代5种浏览器,但在IE9中不起作用.有没有办法在那里做到这一点?
这是一个jfiddle:http://jsfiddle.net/cfCzD/4/
这是截图
IE11(目标):

IE9(结果不好):

html css internet-explorer-9 responsive-design internet-explorer-10
我使用 Java 11.0.1中的Project Jigsaw研究了一个简单的示例,该示例是在Ubuntu 18.04上使用oracle JDK 11构建的。
在该示例之后,我创建了一个简单的项目,该项目可编译为模块,将该模块打包到jar中,然后用于jlink创建独立发行版。一切正常-最终结果是一个很小的文件夹,其中包含简化的JRE和我的模块。
该项目仅由三个文件和一些文件夹组成:
.:
build.sh src
./src:
com module-info.java
./src/com:
greetings
./src/com/greetings:
Main.java
Run Code Online (Sandbox Code Playgroud)
src / com / greetings / Main.java
package com.greetings;
public class Main {
public static void main(String[] args) {
System.out.println("Greetings!");
}
}
Run Code Online (Sandbox Code Playgroud)
src /模块信息.java
module com.greetings { }
Run Code Online (Sandbox Code Playgroud)
build.sh
#/bin/bash
#clean up from last build
rm -rf greetingsapp mlib mods
#compile
javac -d mods/com.greetings src/module-info.java src/com/greetings/Main.java
#Make module jar
mkdir mlib
jar …Run Code Online (Sandbox Code Playgroud) 我写了一个自定义的 TableColumn 宽度调整策略。您可以在 github 上的Java 8 / JavaFX 8 下查看其代码。如您所见,在方法distributeSpaceRatio()等地方,取决于TableColumn.impl_setWidth()我们计算后将列的宽度设置为所需的值。
我正在将我的项目迁移到 Java 11/JavaFX 11,并且该方法impl_setWidth()已从公共视图中删除。
还有另一种方法可以告诉表格列设置其宽度吗?我对任何解决方案持开放态度,只要它可靠并将 with 设置为(或接近)请求的值。
以下是我迄今为止尝试过的两个没有奏效的想法:
尝试 1:
这个给出了 NoMethodFoundException:
private void setColumnWidth ( TableColumn column, double targetWidth ) {
try {
Method method = column.getClass().getDeclaredMethod( "setWidth" );
method.setAccessible( true );
Object r = method.invoke( targetWidth );
} catch ( Exception e ) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
尝试 2:
这个没有效果:
private void setColumnWidth ( TableColumn column, double targetWidth ) { …Run Code Online (Sandbox Code Playgroud) 我正在getAlbumArtist()使用自定义比较器类AlphaNumComparator 通过其方法的输出对"Albums"数组进行排序,该类具有compare比较两个字符串的方法.
我有以下代码,它有效:
AlphanumComparator comparator = new AlphanumComparator ( CaseHandling.CASE_INSENSITIVE );
Arrays.sort( albumArray, ( Album a, Album b ) -> {
return comparator.compare( a.getAlbumArtist(), b.getAlbumArtist() );
});
Run Code Online (Sandbox Code Playgroud)
这看起来像Java中的一些新的langauge功能可以简化/更清晰的代码,但我不能完全适应这些部分.是否有可能,或者它是否像它一样有意义?
我有一个使用ant和eclipse构建的项目,我希望它与Java 8兼容.
当我尝试使用Java 8运行jar时,我收到以下错误:
$ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -jar hypnos.jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/joshuad/musicplayer/MusicPlayerUI has been compiled by a more recent version of
the Java Runtime (class file version 53.0), this version of the Java Runtime only
recognizes class file versions up to 52.0
Run Code Online (Sandbox Code Playgroud)
所以看起来它正在使用Oracle的Java 9(安装在我的系统上)进行编译,但是我无法在eclipse中找到指定它的位置.我看到的一切似乎都表明我们正在使用java 8(截图如下).
我觉得我必须遗漏一些东西,但我无法弄清楚在哪里.为了让这个jar与Java 8/class文件版本52.0兼容,我该怎么办?
Ant构建文件
<project name="Hypnos Music Player" default="compile" basedir=".">
<property name="src" location="src"/>
<property …Run Code Online (Sandbox Code Playgroud) 我已经根据这个答案在JavaFX中创建了一个自定义表格单元格,因此我可以为单元格文本的不同部分设置不同的字体样式.
我在两种不同类型的TableView上使用这个自定义表格单元格:TableView<Track>和TableView<Album>.
两者Track并Album实现接口AlbumInfoSource:
public interface AlbumInfoSource {
public String getAlbumTitle();
public String getFullAlbumTitle();
public String getReleaseType();
public String getDiscSubtitle();
public Integer getDiscCount();
public Integer getDiscNumber();
}
Run Code Online (Sandbox Code Playgroud)
我的自定义TableCell使用该AlbumInfoSource键入,因此它可以为a TableView<Album>和a 渲染单元格TableView<Track>.
这是基本代码:
public class FormattedAlbumCell<T, S> extends TableCell <AlbumInfoSource, String> {
private TextFlow flow;
private Label albumName, albumType, albumDisc;
public FormattedAlbumCell () {
/* Do constructor stuff */
}
@Override
protected void updateItem ( String text, boolean …Run Code Online (Sandbox Code Playgroud)